diff options
author | drh <drh@noemail.net> | 2020-06-19 15:24:12 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-06-19 15:24:12 +0000 |
commit | 067b92ba00887811d9c54c84621b4cfd6f55e27a (patch) | |
tree | e047b726264aad8f2aee65472deafd0b5bda39df /tool/sqldiff.c | |
parent | 1e32bed3c1ce78263598d860d531d3e7e6171929 (diff) | |
download | sqlite-067b92ba00887811d9c54c84621b4cfd6f55e27a.tar.gz sqlite-067b92ba00887811d9c54c84621b4cfd6f55e27a.zip |
Extend the refactoring into extensions. Clean up stray newlines.
FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r-- | tool/sqldiff.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c index 9f5b6fe6d..3590e2c06 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -416,7 +416,7 @@ static void dump_table(const char *zTab, FILE *out){ const char *zSep; /* Separator string */ Str ins; /* Beginning of the INSERT statement */ - pStmt = db_prepare("SELECT sql FROM aux.sqlite_master WHERE name=%Q", zTab); + pStmt = db_prepare("SELECT sql FROM aux.sqlite_schema WHERE name=%Q", zTab); if( SQLITE_ROW==sqlite3_step(pStmt) ){ fprintf(out, "%s;\n", sqlite3_column_text(pStmt,0)); } @@ -466,7 +466,7 @@ static void dump_table(const char *zTab, FILE *out){ sqlite3_finalize(pStmt); strFree(&ins); } /* endif !g.bSchemaOnly */ - pStmt = db_prepare("SELECT sql FROM aux.sqlite_master" + pStmt = db_prepare("SELECT sql FROM aux.sqlite_schema" " WHERE type='index' AND tbl_name=%Q AND sql IS NOT NULL", zTab); while( SQLITE_ROW==sqlite3_step(pStmt) ){ @@ -639,10 +639,10 @@ static void diff_one_table(const char *zTab, FILE *out){ /* Drop indexes that are missing in the destination */ pStmt = db_prepare( - "SELECT name FROM main.sqlite_master" + "SELECT name FROM main.sqlite_schema" " WHERE type='index' AND tbl_name=%Q" " AND sql IS NOT NULL" - " AND sql NOT IN (SELECT sql FROM aux.sqlite_master" + " AND sql NOT IN (SELECT sql FROM aux.sqlite_schema" " WHERE type='index' AND tbl_name=%Q" " AND sql IS NOT NULL)", zTab, zTab); @@ -700,10 +700,10 @@ static void diff_one_table(const char *zTab, FILE *out){ /* Create indexes that are missing in the source */ pStmt = db_prepare( - "SELECT sql FROM aux.sqlite_master" + "SELECT sql FROM aux.sqlite_schema" " WHERE type='index' AND tbl_name=%Q" " AND sql IS NOT NULL" - " AND sql NOT IN (SELECT sql FROM main.sqlite_master" + " AND sql NOT IN (SELECT sql FROM main.sqlite_schema" " WHERE type='index' AND tbl_name=%Q" " AND sql IS NOT NULL)", zTab, zTab); @@ -728,7 +728,7 @@ end_diff_one_table: */ static void checkSchemasMatch(const char *zTab){ sqlite3_stmt *pStmt = db_prepare( - "SELECT A.sql=B.sql FROM main.sqlite_master A, aux.sqlite_master B" + "SELECT A.sql=B.sql FROM main.sqlite_schema A, aux.sqlite_schema B" " WHERE A.name=%Q AND B.name=%Q", zTab, zTab ); if( SQLITE_ROW==sqlite3_step(pStmt) ){ @@ -1757,7 +1757,7 @@ const char *gobble_token(const char *zIn, char *zBuf, int nBuf){ ** module_name(SQL) ** ** The only argument should be an SQL statement of the type that may appear -** in the sqlite_master table. If the statement is a "CREATE VIRTUAL TABLE" +** in the sqlite_schema table. If the statement is a "CREATE VIRTUAL TABLE" ** statement, then the value returned is the name of the module that it ** uses. Otherwise, if the statement is not a CVT, NULL is returned. */ @@ -1816,32 +1816,32 @@ const char *all_tables_sql(){ assert( rc==SQLITE_OK ); return - "SELECT name FROM main.sqlite_master\n" + "SELECT name FROM main.sqlite_schema\n" " WHERE type='table' AND (\n" " module_name(sql) IS NULL OR \n" " module_name(sql) IN (SELECT module FROM temp.tblmap)\n" " ) AND name NOT IN (\n" " SELECT a.name || b.postfix \n" - "FROM main.sqlite_master AS a, temp.tblmap AS b \n" + "FROM main.sqlite_schema AS a, temp.tblmap AS b \n" "WHERE module_name(a.sql) = b.module\n" " )\n" "UNION \n" - "SELECT name FROM aux.sqlite_master\n" + "SELECT name FROM aux.sqlite_schema\n" " WHERE type='table' AND (\n" " module_name(sql) IS NULL OR \n" " module_name(sql) IN (SELECT module FROM temp.tblmap)\n" " ) AND name NOT IN (\n" " SELECT a.name || b.postfix \n" - "FROM aux.sqlite_master AS a, temp.tblmap AS b \n" + "FROM aux.sqlite_schema AS a, temp.tblmap AS b \n" "WHERE module_name(a.sql) = b.module\n" " )\n" " ORDER BY name"; }else{ return - "SELECT name FROM main.sqlite_master\n" + "SELECT name FROM main.sqlite_schema\n" " WHERE type='table' AND sql NOT LIKE 'CREATE VIRTUAL%%'\n" " UNION\n" - "SELECT name FROM aux.sqlite_master\n" + "SELECT name FROM aux.sqlite_schema\n" " WHERE type='table' AND sql NOT LIKE 'CREATE VIRTUAL%%'\n" " ORDER BY name"; } @@ -1955,7 +1955,7 @@ int main(int argc, char **argv){ if( rc ){ cmdlineError("cannot open database file \"%s\"", zDb1); } - rc = sqlite3_exec(g.db, "SELECT * FROM sqlite_master", 0, 0, &zErrMsg); + rc = sqlite3_exec(g.db, "SELECT * FROM sqlite_schema", 0, 0, &zErrMsg); if( rc || zErrMsg ){ cmdlineError("\"%s\" does not appear to be a valid SQLite database", zDb1); } @@ -1974,7 +1974,7 @@ int main(int argc, char **argv){ if( rc || zErrMsg ){ cmdlineError("cannot attach database \"%s\"", zDb2); } - rc = sqlite3_exec(g.db, "SELECT * FROM aux.sqlite_master", 0, 0, &zErrMsg); + rc = sqlite3_exec(g.db, "SELECT * FROM aux.sqlite_schema", 0, 0, &zErrMsg); if( rc || zErrMsg ){ cmdlineError("\"%s\" does not appear to be a valid SQLite database", zDb2); } |