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
This commit is contained in:
+3
-7
@@ -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, '\'');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user