Extend the refactoring into extensions. Clean up stray newlines.
FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
diff --git a/tool/sqldiff.c b/tool/sqldiff.c
index 9f5b6fe..3590e2c 100644
--- a/tool/sqldiff.c
+++ b/tool/sqldiff.c
@@ -416,7 +416,7 @@
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 @@
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 @@
/* 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 @@
/* 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 @@
*/
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 @@
** 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 @@
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 @@
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 @@
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);
}