[-]
[+]
|
Deleted |
pxview-sqlite-backticks.patch
|
@@ -1,157 +0,0 @@
---- 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 != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
- fprintf(stderr, "%s\n", sqlerror);
- sqlite3_free(sqlerror);
-@@ -1674,7 +1674,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++) {
-@@ -1694,12 +1694,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;
-@@ -1708,7 +1708,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;
-@@ -1727,7 +1727,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++;
-@@ -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 != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
- sqlite3_close(db);
- fprintf(stderr, "%s\n", sqlerror);
-@@ -1783,7 +1783,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;
-@@ -2263,11 +2263,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++) {
-@@ -2292,12 +2292,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;
-@@ -2316,7 +2316,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++;
-@@ -2330,7 +2330,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++;
- }
-@@ -2346,7 +2346,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 */
-@@ -2372,7 +2372,7 @@
- case pxfFmtMemoBLOb:
- case pxfGraphic:
- case pxfOLE:
-- fprintf(outfp, "%s", pxf->px_fname);
-+ fprintf(outfp, "`%s`", pxf->px_fname);
- first = 1;
- break;
- }
-@@ -2600,7 +2600,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;
- }
-@@ -2615,9 +2615,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-backticks.patch
^
|
@@ -0,0 +1,157 @@
+--- 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 != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
+ fprintf(stderr, "%s\n", sqlerror);
+ sqlite3_free(sqlerror);
+@@ -1674,7 +1674,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++) {
+@@ -1694,12 +1694,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;
+@@ -1708,7 +1708,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;
+@@ -1727,7 +1727,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++;
+@@ -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 != sqlite3_exec(db, str_buffer_get(pxdoc, sbuf), NULL, NULL, &sqlerror)) {
+ sqlite3_close(db);
+ fprintf(stderr, "%s\n", sqlerror);
+@@ -1783,7 +1783,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;
+@@ -2263,11 +2263,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++) {
+@@ -2292,12 +2292,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;
+@@ -2316,7 +2316,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++;
+@@ -2330,7 +2330,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++;
+ }
+@@ -2346,7 +2346,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 */
+@@ -2372,7 +2372,7 @@
+ case pxfFmtMemoBLOb:
+ case pxfGraphic:
+ case pxfOLE:
+- fprintf(outfp, "%s", pxf->px_fname);
++ fprintf(outfp, "`%s`", pxf->px_fname);
+ first = 1;
+ break;
+ }
+@@ -2600,7 +2600,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;
+ }
+@@ -2615,9 +2615,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]) {
|