mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Escape the "_" character in LIKE patterns in the CLI.
[forum:/forumpost/6a89702f5d|Forum post 6a89702f5d]. FossilOrigin-Name: cf61cd359e666c66b6bba4407a653c799f7f07e1f5ee6b837ad467029c461a6a
This commit is contained in:
@@ -9328,7 +9328,8 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
" (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
|
||||
" FROM sqlite_schema UNION ALL"
|
||||
" SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_schema) "
|
||||
"WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%' "
|
||||
"WHERE type!='meta' AND sql NOTNULL"
|
||||
" AND name NOT LIKE 'sqlite__%' ESCAPE '_' "
|
||||
"ORDER BY x",
|
||||
callback, &data, 0
|
||||
);
|
||||
@@ -10804,7 +10805,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_free(zQarg);
|
||||
}
|
||||
if( bNoSystemTabs ){
|
||||
appendText(&sSelect, "name NOT LIKE 'sqlite_%%' AND ", 0);
|
||||
appendText(&sSelect, "name NOT LIKE 'sqlite__%%' ESCALE '_' AND ", 0);
|
||||
}
|
||||
appendText(&sSelect, "sql IS NOT NULL"
|
||||
" ORDER BY snum, rowid", 0);
|
||||
@@ -11235,7 +11236,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}else{
|
||||
zSql = "SELECT lower(name) as tname FROM sqlite_schema"
|
||||
" WHERE type='table' AND coalesce(rootpage,0)>1"
|
||||
" AND name NOT LIKE 'sqlite_%'"
|
||||
" AND name NOT LIKE 'sqlite__%' ESCAPE '_'"
|
||||
" ORDER BY 1 collate nocase";
|
||||
}
|
||||
sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
|
||||
@@ -11300,7 +11301,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
char *zRevText = /* Query for reversible to-blob-to-text check */
|
||||
"SELECT lower(name) as tname FROM sqlite_schema\n"
|
||||
"WHERE type='table' AND coalesce(rootpage,0)>1\n"
|
||||
"AND name NOT LIKE 'sqlite_%%'%s\n"
|
||||
"AND name NOT LIKE 'sqlite__%%' ESCAPE '_'%s\n"
|
||||
"ORDER BY 1 collate nocase";
|
||||
zRevText = sqlite3_mprintf(zRevText, zLike? " AND name LIKE $tspec" : "");
|
||||
zRevText = sqlite3_mprintf(
|
||||
@@ -11496,7 +11497,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
appendText(&s, ".sqlite_schema ", 0);
|
||||
if( c=='t' ){
|
||||
appendText(&s," WHERE type IN ('table','view')"
|
||||
" AND name NOT LIKE 'sqlite_%'"
|
||||
" AND name NOT LIKE 'sqlite__%' ESCAPE '_'"
|
||||
" AND name LIKE ?1", 0);
|
||||
}else{
|
||||
appendText(&s," WHERE type='index'"
|
||||
|
Reference in New Issue
Block a user