]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Always quote the names of tables in the output of the shell's ".dump" command,
authordrh <drh@noemail.net>
Thu, 22 Mar 2012 12:50:34 +0000 (12:50 +0000)
committerdrh <drh@noemail.net>
Thu, 22 Mar 2012 12:50:34 +0000 (12:50 +0000)
even if the name is pure alphabetic text, in case the name is a keyword.

FossilOrigin-Name: 638b71150281a211f89b4057b0d5d32d3fbcf323

manifest
manifest.uuid
src/shell.c

index 60db4f1f2e3489ed1c4484af3a1772500f0752fa..a8b57dd4e9d3cb98142f9ae794ddfcc73648a300 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sthe\s_SafeInit()\sentry\spoints\sfrom\sthe\sTCL\sinterface.\s\sThey\shave\slong\nbeen\sno-ops.\s\sRemoving\sthem\scompletely\savoids\sconfusion\sas\sto\swhy\sthey\ndon't\swork.
-D 2012-03-20T15:10:42.442
+C Always\squote\sthe\snames\sof\stables\sin\sthe\soutput\sof\sthe\sshell's\s".dump"\scommand,\neven\sif\sthe\sname\sis\spure\salphabetic\stext,\sin\scase\sthe\sname\sis\sa\skeyword.
+D 2012-03-22T12:50:34.137
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -181,7 +181,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
 F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c 44ccdcb5d2a1c48622c179b2d72167b716388581
-F src/shell.c aa28f117033ba3e44b5eaaf2ad572222bcdfd66e
+F src/shell.c 55e09ef7126768b940427d95dc0a8cb7138e95da
 F src/sqlite.h.in 6af2d92925bfed3dfd2c022fef48469762ccd435
 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
 F src/sqliteInt.h e65429a6f19b41720561b9434b2192574a91cfa2
@@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 00bb9c9ce4f465e6ac321ced2a9d0062dc364669
-R 0bae8756351ce6c993966becd439fadf
+P 0fb26c7bfa7a4bb1503f90fd6f5b9c70f444665b
+R 76825aab78a4aec4e0f8b3a0fc8144af
 U drh
-Z d1e2a2d0a2cbd6a9676ec1f5c607220d
+Z cbcc6857e5f2528670826efd0ad94a0c
index f2c6d71cbbf8eeb6c410fee1e900c558535012b0..f6c5dfb8e20f7423e50382acb1e82f93ab8d48bf 100644 (file)
@@ -1 +1 @@
-0fb26c7bfa7a4bb1503f90fd6f5b9c70f444665b
\ No newline at end of file
+638b71150281a211f89b4057b0d5d32d3fbcf323
\ No newline at end of file
index d3ddfa95360758a0ffa1e15120f9124c9907937c..9ea5ced28234a0750355b8bc4a9e36e97c167812 100644 (file)
@@ -1287,7 +1287,6 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
     char *zTableInfo = 0;
     char *zTmp = 0;
     int nRow = 0;
-    int kk;
    
     zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
     zTableInfo = appendText(zTableInfo, zTable, '"');
@@ -1300,12 +1299,9 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
     }
 
     zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
-    if( !isalpha(zTable[0]) ){
-      kk = 0;
-    }else{
-      for(kk=1; isalnum(zTable[kk]); kk++){}
-    }
-    zTmp = appendText(zTmp, zTable, zTable[kk] ? '"' : 0);
+    /* Always quote the table name, even if it appears to be pure ascii,
+    ** in case it is a keyword. Ex:  INSERT INTO "table" ... */
+    zTmp = appendText(zTmp, zTable, '"');
     if( zTmp ){
       zSelect = appendText(zSelect, zTmp, '\'');
     }