From: drh Date: Thu, 22 Mar 2012 12:50:34 +0000 (+0000) Subject: Always quote the names of tables in the output of the shell's ".dump" command, X-Git-Tag: mountain-lion~3^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf92ec0ce349f754d4b8df75f415138fa915cd43;p=thirdparty%2Fsqlite.git Always quote the names of tables in the output of the shell's ".dump" command, even if the name is pure alphabetic text, in case the name is a keyword. FossilOrigin-Name: 638b71150281a211f89b4057b0d5d32d3fbcf323 --- diff --git a/manifest b/manifest index 60db4f1f2e..a8b57dd4e9 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index f2c6d71cbb..f6c5dfb8e2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0fb26c7bfa7a4bb1503f90fd6f5b9c70f444665b \ No newline at end of file +638b71150281a211f89b4057b0d5d32d3fbcf323 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index d3ddfa9536..9ea5ced282 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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, '\''); }