change from sqlite_master to sqlite_schema
This commit is contained in:
parent
4a459028c5
commit
d7f468c998
14
src/crypto.c
14
src/crypto.c
|
@ -1114,7 +1114,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
*/
|
||||
zSql = sqlite3_mprintf(
|
||||
"SELECT sql "
|
||||
" FROM %s.sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
|
||||
" FROM %s.sqlite_schema WHERE type='table' AND name!='sqlite_sequence'"
|
||||
" AND rootpage>0"
|
||||
, sourceDb);
|
||||
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
|
||||
|
@ -1123,7 +1123,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
|
||||
zSql = sqlite3_mprintf(
|
||||
"SELECT sql "
|
||||
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE INDEX %%' "
|
||||
" FROM %s.sqlite_schema WHERE sql LIKE 'CREATE INDEX %%' "
|
||||
, sourceDb);
|
||||
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
|
||||
if( rc!=SQLITE_OK ) goto end_of_export;
|
||||
|
@ -1131,7 +1131,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
|
||||
zSql = sqlite3_mprintf(
|
||||
"SELECT sql "
|
||||
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%'"
|
||||
" FROM %s.sqlite_schema WHERE sql LIKE 'CREATE UNIQUE INDEX %%'"
|
||||
, sourceDb);
|
||||
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
|
||||
if( rc!=SQLITE_OK ) goto end_of_export;
|
||||
|
@ -1144,7 +1144,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
zSql = sqlite3_mprintf(
|
||||
"SELECT 'INSERT INTO %s.' || quote(name) "
|
||||
"|| ' SELECT * FROM %s.' || quote(name) || ';'"
|
||||
"FROM %s.sqlite_master "
|
||||
"FROM %s.sqlite_schema "
|
||||
"WHERE type = 'table' AND name!='sqlite_sequence' "
|
||||
" AND rootpage>0"
|
||||
, targetDb, sourceDb, sourceDb);
|
||||
|
@ -1157,7 +1157,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
zSql = sqlite3_mprintf(
|
||||
"SELECT 'INSERT INTO %s.' || quote(name) "
|
||||
"|| ' SELECT * FROM %s.' || quote(name) || ';' "
|
||||
"FROM %s.sqlite_master WHERE name=='sqlite_sequence';"
|
||||
"FROM %s.sqlite_schema WHERE name=='sqlite_sequence';"
|
||||
, targetDb, sourceDb, targetDb);
|
||||
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
|
||||
if( rc!=SQLITE_OK ) goto end_of_export;
|
||||
|
@ -1169,9 +1169,9 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
|
|||
** from the SQLITE_MASTER table.
|
||||
*/
|
||||
zSql = sqlite3_mprintf(
|
||||
"INSERT INTO %s.sqlite_master "
|
||||
"INSERT INTO %s.sqlite_schema "
|
||||
" SELECT type, name, tbl_name, rootpage, sql"
|
||||
" FROM %s.sqlite_master"
|
||||
" FROM %s.sqlite_schema"
|
||||
" WHERE type='view' OR type='trigger'"
|
||||
" OR (type='table' AND rootpage=0)"
|
||||
, targetDb, sourceDb);
|
||||
|
|
|
@ -148,7 +148,7 @@ do_test codec-error-journal-wal-read {
|
|||
|
||||
catchsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
PRAGMA cipher_fail_next_decrypt = 1;
|
||||
UPDATE t1 SET b = 'fail' WHERE a = 5000;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ do_test unencrypted-corrupt-to-encrypted-export {
|
|||
|
||||
PRAGMA writable_schema = ON;
|
||||
|
||||
UPDATE sqlite_master SET sql = 'CREATE TABLE IF NOT EXISTS t1(a,b)'
|
||||
UPDATE sqlite_schema SET sql = 'CREATE TABLE IF NOT EXISTS t1(a,b)'
|
||||
WHERE tbl_name = 't1';
|
||||
|
||||
PRAGMA writable_schema = OFF;
|
||||
|
@ -254,7 +254,7 @@ do_test unencrypted-corrupt-to-encrypted-export {
|
|||
sqlite_orig db test2.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkey2';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 1 2}
|
||||
|
@ -841,7 +841,7 @@ do_test multipage-schema {
|
|||
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
SELECT count(*) FROM sqlite_schema where type = 'table';
|
||||
} db
|
||||
|
||||
} {ok 300}
|
||||
|
@ -875,7 +875,7 @@ do_test multipage-schema-autovacuum-shortread {
|
|||
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
SELECT count(*) FROM sqlite_schema where type = 'table';
|
||||
} db
|
||||
|
||||
} {ok 300}
|
||||
|
@ -906,7 +906,7 @@ do_test multipage-schema-autovacuum-shortread-wal {
|
|||
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
SELECT count(*) FROM sqlite_schema where type = 'table';
|
||||
} db
|
||||
} {ok 300}
|
||||
db close
|
||||
|
@ -1028,7 +1028,7 @@ do_test 2.0-beta-to-2.0-migration {
|
|||
PRAGMA cipher_page_size = 1024;
|
||||
PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
|
||||
PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
|
||||
PRAGMA cipher_hmac_salt_mask = "x'3a'";
|
||||
ATTACH DATABASE 'test.db' AS db2 KEY 'testkey';
|
||||
|
@ -1060,7 +1060,7 @@ do_test migrate-1.1.8-database-to-current-format {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
}
|
||||
} {ok 1}
|
||||
db close
|
||||
|
@ -1078,7 +1078,7 @@ do_test migrate-2-0-le-database-to-current-format {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
}
|
||||
} {ok 1}
|
||||
db close
|
||||
|
@ -1096,7 +1096,7 @@ do_test migrate-3-0-database-to-current-format {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
PRAGMA journal_mode;
|
||||
}
|
||||
} {ok 1 delete}
|
||||
|
@ -1126,7 +1126,7 @@ do_test migrate-wal-database-to-current {
|
|||
sqlite_orig db test.db
|
||||
lappend rc [execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM sqlite_schema;
|
||||
PRAGMA journal_mode;
|
||||
}]
|
||||
} {{ok wal} {ok 0 wal} {ok 1 wal}}
|
||||
|
|
|
@ -49,7 +49,7 @@ do_test will-open-with-correct-raw-key {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = "x'98483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C4836481'";
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
SELECT * from t1;
|
||||
}
|
||||
} {ok t1 test1 test2}
|
||||
|
@ -67,7 +67,7 @@ do_test will-open-with-correct-derived-key {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
SELECT * from t1;
|
||||
}
|
||||
} {ok t1 test1 test2}
|
||||
|
@ -112,7 +112,7 @@ setup test.db "'testkey'"
|
|||
do_test wont-open-without-key {
|
||||
sqlite_orig db test.db
|
||||
catchsql {
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
db close
|
||||
|
@ -126,7 +126,7 @@ do_test wont-open-with-invalid-derived-key {
|
|||
sqlite_orig db test.db
|
||||
catchsql {
|
||||
PRAGMA key = 'testkey2';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
db close
|
||||
|
@ -140,7 +140,7 @@ do_test wont-open-with-invalid-raw-key {
|
|||
sqlite_orig db test.db
|
||||
catchsql {
|
||||
PRAGMA key = "x'98483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C4836480'";
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
db close
|
||||
|
@ -525,7 +525,7 @@ do_test custom-pagesize-must-match {
|
|||
sqlite_orig db test.db
|
||||
catchsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
db close
|
||||
|
@ -575,21 +575,21 @@ do_test multiple-key-calls-safe-1 {
|
|||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
PRAGMA cache_size = 0;
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {ok t1}
|
||||
|
||||
do_test multiple-key-calls-safe-2 {
|
||||
catchsql {
|
||||
PRAGMA key = 'wrong key';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
|
||||
do_test multiple-key-calls-safe-3 {
|
||||
execsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {ok t1}
|
||||
|
||||
|
@ -640,7 +640,7 @@ do_test custom-hmac-kdf-iter-must-match {
|
|||
sqlite_orig db test.db
|
||||
catchsql {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {1 {file is not a database}}
|
||||
db close
|
||||
|
|
|
@ -118,7 +118,7 @@ do_test rekey-as-first-operation {
|
|||
sqlite_orig db test.db
|
||||
execsql {
|
||||
PRAGMA key = 'testkeynew';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT name FROM sqlite_schema WHERE type='table';
|
||||
}
|
||||
} {ok t1}
|
||||
db close
|
||||
|
|
Loading…
Reference in New Issue