1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix another problem with ".expert" and virtual tables. [forum:/forumpost/49d6a19ec|Forum post 49d6a19ec].

FossilOrigin-Name: 7a7162293c8fdb0078fe56948d697703539dd23273b2072990d4391c761e6ae2
This commit is contained in:
dan
2024-10-20 07:19:38 +00:00
parent 72c5b9bf0e
commit b74c7880d6
4 changed files with 37 additions and 12 deletions

View File

@ -1463,7 +1463,7 @@ static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){
** 2) Create the equivalent virtual table in dbv.
*/
rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg,
"SELECT type, name, sql, 1, sql LIKE 'create virtual%' "
"SELECT type, name, sql, 1, sql LIKE 'create virtual%%' "
"FROM sqlite_schema "
"WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%' "
" UNION ALL "
@ -2024,9 +2024,9 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){
if( rc==SQLITE_OK ){
sqlite3_stmt *pSql = 0;
rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
"SELECT sql, name "
"SELECT sql, name, sql LIKE 'create virtual%%' AS virt "
" FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'"
" ORDER BY rowid"
" ORDER BY virt DESC, rowid"
);
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
const char *zSql = (const char*)sqlite3_column_text(pSql, 0);