@@ -1,16 +1,15 @@
-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 @@
+--- pxview-0.2.5/src/main.c.orig 2012-03-23 22:28:41.573148024 +0100
++++ pxview-0.2.5/src/main.c 2012-03-23 22:31:38.076492280 +0100
+@@ -1658,7 +1658,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)) {
+ if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
fprintf(stderr, "%s\n", sqlerror);
- sqlite_close(sql);
-@@ -1671,7 +1671,7 @@
+ sqlite3_free(sqlerror);
+@@ -1674,7 +1674,7 @@
/* Output table schema */
if(!skipschema) {
str_buffer_clear(pxdoc, sbuf);
@@ -19,7 +18,7 @@
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 @@
+@@ -1694,12 +1694,12 @@
case pxfTime:
case pxfTimestamp:
case pxfBytes:
@@ -34,7 +33,7 @@
str_buffer_print(pxdoc, sbuf, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_fdc));
first = 1;
break;
-@@ -1705,7 +1705,7 @@
+@@ -1708,7 +1708,7 @@
case pxfFmtMemoBLOb:
case pxfGraphic:
case pxfOLE:
@@ -43,7 +42,7 @@
str_buffer_print(pxdoc, sbuf, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_flen));
first = 1;
break;
-@@ -1724,7 +1724,7 @@
+@@ -1727,7 +1727,7 @@
strrep(pxf->px_fname, ' ', '_');
if(first == 1)
str_buffer_print(pxdoc, sbuf, ",");
@@ -52,16 +51,16 @@
first = 1;
}
pxf++;
-@@ -1750,7 +1750,7 @@
+@@ -1754,7 +1754,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);
+ if(SQLITE_OK != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
+ sqlite3_close(db);
fprintf(stderr, "%s\n", sqlerror);
-@@ -1778,7 +1778,7 @@
+@@ -1783,7 +1783,7 @@
for(j=0; j<PX_get_num_records(pxdoc); j++) {
int offset;
str_buffer_clear(pxdoc, sbuf);
@@ -70,7 +69,7 @@
if(PX_get_record(pxdoc, j, data)) {
first = 0; // set to 1 when first field has been output
offset = 0;
-@@ -2257,11 +2257,11 @@
+@@ -2263,11 +2263,11 @@
/* check if existing table shall be delete */
if(deletetable) {
@@ -84,7 +83,7 @@
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 @@
+@@ -2292,12 +2292,12 @@
case pxfFmtMemoBLOb:
case pxfGraphic:
case pxfOLE:
@@ -99,7 +98,7 @@
fprintf(outfp, "%s", get_sql_type(typemap, pxf->px_ftype, pxf->px_fdc));
first = 1;
break;
-@@ -2310,7 +2310,7 @@
+@@ -2316,7 +2316,7 @@
strrep(pxf->px_fname, ' ', '_');
if(first == 1)
fprintf(outfp, ",");
@@ -108,7 +107,7 @@
first = 1;
}
pxf++;
-@@ -2324,7 +2324,7 @@
+@@ -2330,7 +2330,7 @@
for(i=0; i<primarykeyfields; i++) {
if(fieldregex == NULL || selectedfields[i]) {
strrep(pxf->px_fname, ' ', '_');
@@ -117,7 +116,7 @@
}
pxf++;
}
-@@ -2340,7 +2340,7 @@
+@@ -2346,7 +2346,7 @@
}
if(usecopy) {
@@ -126,7 +125,7 @@
first = 0; // set to 1 when first field has been output
pxf = PX_get_fields(pxdoc);
/* output field name */
-@@ -2366,7 +2366,7 @@
+@@ -2372,7 +2372,7 @@
case pxfFmtMemoBLOb:
case pxfGraphic:
case pxfOLE:
@@ -135,7 +134,7 @@
first = 1;
break;
}
-@@ -2594,7 +2594,7 @@
+@@ -2600,7 +2600,7 @@
case pxfBLOb:
case pxfGraphic:
case pxfOLE:
@@ -144,7 +143,7 @@
first = 1;
break;
}
-@@ -2609,9 +2609,9 @@
+@@ -2615,9 +2615,9 @@
first = 0; // set to 1 when first field has been output
offset = 0;
if(shortinsert)
|
@@ -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]) {
|