Changes of Revision 13
[-] | Changed | pxview.spec |
x 1
2 Group: Applications/Utils 3 Url: http://pxlib.sourceforge.net/ 4 Source: http://prdownloads.sourceforge.net/pxlib/%{name}-%{version}.tar.bz2 5 +Patch0: pxview-sqlite3.patch 6 +Patch1: pxview-backticks.patch 7 BuildRoot: %{_tmppath}/%{name}-%{version}-root 8 Prefix: /usr 9 -BuildRequires: pxlib-devel perl-XML-Parser docbook-to-man 10 +BuildRequires: gcc-c++ libpx-devel perl-XML-Parser docbook-to-man 11 12 %if 0%{?suse_version} >= 1110 13 BuildRequires: sqlite-devel 14
15 16 %prep 17 %setup 18 +%if 0%{?suse_version} >= 1110 19 +%patch0 -p1 20 +%endif 21 +%patch1 -p1 22 23 %build 24 %configure --with-sqlite || cat config.log 25 |
||
[+] | Added | pxview-backticks.patch ^ |
@@ -0,0 +1,158 @@ +diff -Naur pxview-0.2.5/src/main.c pxview-backticks/src/main.c +--- pxview-0.2.5/src/main.c 2005-08-09 20:57:20.000000000 +0100 ++++ pxview-backticks/src/main.c 2008-11-18 16:09:04.000000000 +0000 +@@ -1656,7 +1656,7 @@ + + /* check if existing table shall be delete */ + if(deletetable) { +- str_buffer_print(pxdoc, sbuf, "DROP TABLE %s;\n", tablename); ++ str_buffer_print(pxdoc, sbuf, "DROP TABLE `%s`;\n", tablename); + if(SQLITE_OK != sqlite_exec(sql, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) { + fprintf(stderr, "%s\n", sqlerror); + sqlite_close(sql); +@@ -1671,7 +1671,7 @@ + /* Output table schema */ + if(!skipschema) { + str_buffer_clear(pxdoc, sbuf); +- str_buffer_print(pxdoc, sbuf, "CREATE TABLE %s (\n", tablename); ++ str_buffer_print(pxdoc, sbuf, "CREATE TABLE `%s` (\n", tablename); + first = 0; // set to 1 when first field has been output + pxf = PX_get_fields(pxdoc); + for(i=0; i<PX_get_num_fields(pxdoc); i++) { +@@ -1691,12 +1691,12 @@ + case pxfTime: + case pxfTimestamp: + case pxfBytes: +- str_buffer_print(pxdoc, sbuf, " %s ", pxf->px_fname); ++ str_buffer_print(pxdoc, sbuf, " `%s` ", pxf->px_fname); + str_buffer_print(pxdoc, sbuf, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_flen)); + first = 1; + break; + case pxfBCD: +- str_buffer_print(pxdoc, sbuf, " %s ", pxf->px_fname); ++ str_buffer_print(pxdoc, sbuf, " `%s` ", pxf->px_fname); + str_buffer_print(pxdoc, sbuf, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_fdc)); + first = 1; + break; +@@ -1705,7 +1705,7 @@ + case pxfFmtMemoBLOb: + case pxfGraphic: + case pxfOLE: +- str_buffer_print(pxdoc, sbuf, " %s ", pxf->px_fname); ++ str_buffer_print(pxdoc, sbuf, " `%s` ", pxf->px_fname); + str_buffer_print(pxdoc, sbuf, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_flen)); + first = 1; + break; +@@ -1724,7 +1724,7 @@ + strrep(pxf->px_fname, ' ', '_'); + if(first == 1) + str_buffer_print(pxdoc, sbuf, ","); +- str_buffer_print(pxdoc, sbuf, "%s", pxf->px_fname); ++ str_buffer_print(pxdoc, sbuf, "`%s`", pxf->px_fname); + first = 1; + } + pxf++; +@@ -1750,7 +1750,7 @@ + if(fieldregex == NULL || selectedfields[i]) { + 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); ++ 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); + fprintf(stderr, "%s\n", sqlerror); +@@ -1778,7 +1778,7 @@ + for(j=0; j<PX_get_num_records(pxdoc); j++) { + int offset; + str_buffer_clear(pxdoc, sbuf); +- str_buffer_print(pxdoc, sbuf, "INSERT INTO %s VALUES (", tablename); ++ str_buffer_print(pxdoc, sbuf, "INSERT INTO `%s` VALUES (", tablename); + if(PX_get_record(pxdoc, j, data)) { + first = 0; // set to 1 when first field has been output + offset = 0; +@@ -2257,11 +2257,11 @@ + + /* check if existing table shall be delete */ + if(deletetable) { +- fprintf(outfp, "DROP TABLE %s;\n", tablename); ++ fprintf(outfp, "DROP TABLE `%s`;\n", tablename); + } + /* Output table schema */ + if(!skipschema) { +- fprintf(outfp, "CREATE TABLE %s (\n", tablename); ++ fprintf(outfp, "CREATE TABLE `%s` (\n", tablename); + first = 0; // set to 1 when first field has been output + pxf = PX_get_fields(pxdoc); + for(i=0; i<PX_get_num_fields(pxdoc); i++) { +@@ -2286,12 +2286,12 @@ + case pxfFmtMemoBLOb: + case pxfGraphic: + case pxfOLE: +- fprintf(outfp, " %s ", pxf->px_fname); ++ fprintf(outfp, " `%s` ", pxf->px_fname); + fprintf(outfp, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_flen)); + first = 1; + break; + case pxfBCD: +- fprintf(outfp, " %s ", pxf->px_fname); ++ fprintf(outfp, " `%s` ", pxf->px_fname); + fprintf(outfp, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_fdc)); + first = 1; + break; +@@ -2310,7 +2310,7 @@ + strrep(pxf->px_fname, ' ', '_'); + if(first == 1) + fprintf(outfp, ","); +- fprintf(outfp, "%s", pxf->px_fname); ++ fprintf(outfp, "`%s`", pxf->px_fname); + first = 1; + } + pxf++; +@@ -2324,7 +2324,7 @@ + for(i=0; i<primarykeyfields; i++) { + if(fieldregex == NULL || selectedfields[i]) { + strrep(pxf->px_fname, ' ', '_'); +- fprintf(outfp, "CREATE INDEX %s_%s_index on %s (%s);\n", tablename, pxf->px_fname, tablename, pxf->px_fname); ++ fprintf(outfp, "CREATE INDEX %s_%s_index on `%s` (`%s`);\n", tablename, pxf->px_fname, tablename, pxf->px_fname); + } + pxf++; + } +@@ -2340,7 +2340,7 @@ + } + + if(usecopy) { +- fprintf(outfp, "COPY %s (", tablename); ++ fprintf(outfp, "COPY `%s` (", tablename); + first = 0; // set to 1 when first field has been output + pxf = PX_get_fields(pxdoc); + /* output field name */ +@@ -2366,7 +2366,7 @@ + case pxfFmtMemoBLOb: + case pxfGraphic: + case pxfOLE: +- fprintf(outfp, "%s", pxf->px_fname); ++ fprintf(outfp, "`%s`", pxf->px_fname); + first = 1; + break; + } +@@ -2594,7 +2594,7 @@ + case pxfBLOb: + case pxfGraphic: + case pxfOLE: +- str_buffer_print(pxdoc, sbuf, "%s", pxf->px_fname); ++ str_buffer_print(pxdoc, sbuf, "`%s`", pxf->px_fname); + first = 1; + break; + } +@@ -2609,9 +2609,9 @@ + first = 0; // set to 1 when first field has been output + offset = 0; + if(shortinsert) +- fprintf(outfp, "insert into %s values (", tablename); ++ fprintf(outfp, "insert into `%s` values (", tablename); + else +- fprintf(outfp, "insert into %s %s values (", tablename, str_buffer_get(pxdoc, sbuf)); ++ fprintf(outfp, "insert into `%s` `%s` values (", tablename, str_buffer_get(pxdoc, sbuf)); + pxf = PX_get_fields(pxdoc); + for(i=0; i<PX_get_num_fields(pxdoc); i++) { + if(fieldregex == NULL || selectedfields[i]) { | ||
[+] | Added | pxview-sqlite3.patch ^ |
@@ -0,0 +1,135 @@ +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 |