Search
j0ke.net Open Build Service
>
Projects
>
server:database
:
paradox
>
pxview
> pxview-sqlite3.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File pxview-sqlite3.patch of Package pxview
diff -Naur pxview-0.2.5/configure.in pxview-sqlite3/configure.in --- pxview-0.2.5/configure.in 2005-06-07 21:51:38.000000000 +0100 +++ pxview-sqlite3/configure.in 2008-11-13 23:53:04.000000000 +0000 @@ -105,28 +105,28 @@ if test "x$withval" = xno; then AC_MSG_RESULT("disable by user") else - if test -r ${withval}/include/sqlite.h ; then + if test -r ${withval}/include/sqlite3.h ; then SQLITE_LIBDIR=-L${withval}/lib SQLITE_INCLUDEDIR="-I${withval}/include" try_sqlite=true else - if test -r /usr/include/sqlite.h ; then + if test -r /usr/include/sqlite3.h ; then SQLITE_LIBDIR=-L/usr SQLITE_INCLUDEDIR="-I/usr/include" try_sqlite=true else - AC_MSG_ERROR(header file for sqlite not found) + AC_MSG_ERROR(header file for sqlite3 not found) try_sqlite=false fi fi if test "$try_sqlite" = "true"; then - AC_CHECK_LIB(sqlite, sqlite_open, - SQLITE_LIBDIR="$SQLITE_LIBDIR -lsqlite", - AC_MSG_RESULT([libsqlite not found]), + AC_CHECK_LIB(sqlite3, sqlite3_open, + SQLITE_LIBDIR="$SQLITE_LIBDIR -lsqlite3", + AC_MSG_RESULT([libsqlite3 not found]), "$SQLITE_LIBDIR") - SQLITE_LIBS=-lsqlite + SQLITE_LIBS=-lsqlite3 AC_DEFINE(HAVE_SQLITE, 1, [Define if you have the sqlite library.]) fi fi diff -Naur pxview-0.2.5/src/main.c pxview-sqlite3/src/main.c --- pxview-0.2.5/src/main.c 2005-08-09 20:57:20.000000000 +0100 +++ pxview-sqlite3/src/main.c 2008-11-14 22:51:43.000000000 +0000 @@ -20,7 +20,7 @@ #endif #ifdef HAVE_SQLITE -#include <sqlite.h> +#include <sqlite3.h> #endif #ifdef ENABLE_NLS @@ -1619,9 +1619,9 @@ */ if(outputsqlite) { int numrecords; - sqlite *sql; + sqlite3 *db; struct str_buffer *sbuf; - char *sqlerror; + char *sqlerror = NULL; if((filetype != pxfFileTypIndexDB) && (filetype != pxfFileTypNonIndexDB)) { @@ -1647,7 +1647,9 @@ exit(1); } - if((sql = sqlite_open(outputfile, 0, NULL)) == NULL) { + if(sqlite3_open(outputfile, &db)) { + fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); + sqlite3_close(db); if(selectedfields) pxdoc->free(pxdoc, selectedfields); PX_close(pxdoc); @@ -1657,9 +1659,10 @@ /* check if existing table shall be delete */ if(deletetable) { str_buffer_print(pxdoc, sbuf, "DROP TABLE %s;\n", tablename); - if(SQLITE_OK != sqlite_exec(sql, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { + if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { fprintf(stderr, "%s\n", sqlerror); - sqlite_close(sql); + sqlite3_free(sqlerror); + sqlite3_close(db); str_buffer_delete(pxdoc, sbuf); pxdoc->free(pxdoc, data); if(selectedfields) @@ -1733,9 +1736,10 @@ } str_buffer_print(pxdoc, sbuf, ");"); - if(SQLITE_OK != sqlite_exec(sql, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { - sqlite_close(sql); + if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { + sqlite3_close(db); fprintf(stderr, "%s\n", sqlerror); + sqlite3_free(sqlerror); str_buffer_delete(pxdoc, sbuf); pxdoc->free(pxdoc, data); if(selectedfields) @@ -1751,9 +1755,10 @@ strrep(pxf->px_fname, ' ', '_'); str_buffer_clear(pxdoc, sbuf); str_buffer_print(pxdoc, sbuf, "CREATE INDEX %s_%s_index on %s (%s);", tablename, pxf->px_fname, tablename, pxf->px_fname); - if(SQLITE_OK != sqlite_exec(sql, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { - sqlite_close(sql); + if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { + sqlite3_close(db); fprintf(stderr, "%s\n", sqlerror); + sqlite3_free(sqlerror); str_buffer_delete(pxdoc, sbuf); pxdoc->free(pxdoc, data); if(selectedfields) @@ -1961,9 +1966,10 @@ fprintf(stderr, _("Couldn't get record number %d\n"), j); } - if(SQLITE_OK != sqlite_exec(sql, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { - sqlite_close(sql); + if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { + sqlite3_close(db); fprintf(stderr, "%s\n", sqlerror); + sqlite3_free(sqlerror); str_buffer_delete(pxdoc, sbuf); pxdoc->free(pxdoc, data); if(selectedfields) @@ -1976,7 +1982,7 @@ str_buffer_delete(pxdoc, sbuf); pxdoc->free(pxdoc, data); - sqlite_close(sql); + sqlite3_close(db); } /* }}} */ #endif