Skip to content

Commit d7f468c

Browse files
committed
change from sqlite_master to sqlite_schema
1 parent 4a45902 commit d7f468c

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

src/crypto.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
11141114
*/
11151115
zSql = sqlite3_mprintf(
11161116
"SELECT sql "
1117-
" FROM %s.sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
1117+
" FROM %s.sqlite_schema WHERE type='table' AND name!='sqlite_sequence'"
11181118
" AND rootpage>0"
11191119
, sourceDb);
11201120
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
@@ -1123,15 +1123,15 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
11231123

11241124
zSql = sqlite3_mprintf(
11251125
"SELECT sql "
1126-
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE INDEX %%' "
1126+
" FROM %s.sqlite_schema WHERE sql LIKE 'CREATE INDEX %%' "
11271127
, sourceDb);
11281128
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
11291129
if( rc!=SQLITE_OK ) goto end_of_export;
11301130
sqlite3_free(zSql);
11311131

11321132
zSql = sqlite3_mprintf(
11331133
"SELECT sql "
1134-
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%'"
1134+
" FROM %s.sqlite_schema WHERE sql LIKE 'CREATE UNIQUE INDEX %%'"
11351135
, sourceDb);
11361136
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
11371137
if( rc!=SQLITE_OK ) goto end_of_export;
@@ -1144,7 +1144,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
11441144
zSql = sqlite3_mprintf(
11451145
"SELECT 'INSERT INTO %s.' || quote(name) "
11461146
"|| ' SELECT * FROM %s.' || quote(name) || ';'"
1147-
"FROM %s.sqlite_master "
1147+
"FROM %s.sqlite_schema "
11481148
"WHERE type = 'table' AND name!='sqlite_sequence' "
11491149
" AND rootpage>0"
11501150
, targetDb, sourceDb, sourceDb);
@@ -1157,7 +1157,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
11571157
zSql = sqlite3_mprintf(
11581158
"SELECT 'INSERT INTO %s.' || quote(name) "
11591159
"|| ' SELECT * FROM %s.' || quote(name) || ';' "
1160-
"FROM %s.sqlite_master WHERE name=='sqlite_sequence';"
1160+
"FROM %s.sqlite_schema WHERE name=='sqlite_sequence';"
11611161
, targetDb, sourceDb, targetDb);
11621162
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
11631163
if( rc!=SQLITE_OK ) goto end_of_export;
@@ -1169,9 +1169,9 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar
11691169
** from the SQLITE_MASTER table.
11701170
*/
11711171
zSql = sqlite3_mprintf(
1172-
"INSERT INTO %s.sqlite_master "
1172+
"INSERT INTO %s.sqlite_schema "
11731173
" SELECT type, name, tbl_name, rootpage, sql"
1174-
" FROM %s.sqlite_master"
1174+
" FROM %s.sqlite_schema"
11751175
" WHERE type='view' OR type='trigger'"
11761176
" OR (type='table' AND rootpage=0)"
11771177
, targetDb, sourceDb);

test/sqlcipher-codecerror.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ do_test codec-error-journal-wal-read {
148148

149149
catchsql {
150150
PRAGMA key = 'testkey';
151-
SELECT count(*) FROM sqlite_master;
151+
SELECT count(*) FROM sqlite_schema;
152152
PRAGMA cipher_fail_next_decrypt = 1;
153153
UPDATE t1 SET b = 'fail' WHERE a = 5000;
154154
}

test/sqlcipher-compatibility.test

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ do_test unencrypted-corrupt-to-encrypted-export {
237237

238238
PRAGMA writable_schema = ON;
239239

240-
UPDATE sqlite_master SET sql = 'CREATE TABLE IF NOT EXISTS t1(a,b)'
240+
UPDATE sqlite_schema SET sql = 'CREATE TABLE IF NOT EXISTS t1(a,b)'
241241
WHERE tbl_name = 't1';
242242

243243
PRAGMA writable_schema = OFF;
@@ -254,7 +254,7 @@ do_test unencrypted-corrupt-to-encrypted-export {
254254
sqlite_orig db test2.db
255255
execsql {
256256
PRAGMA key = 'testkey2';
257-
SELECT count(*) FROM sqlite_master;
257+
SELECT count(*) FROM sqlite_schema;
258258
SELECT count(*) FROM t1;
259259
}
260260
} {ok 1 2}
@@ -841,7 +841,7 @@ do_test multipage-schema {
841841

842842
execsql {
843843
PRAGMA key = 'testkey';
844-
SELECT count(*) FROM sqlite_master where type = 'table';
844+
SELECT count(*) FROM sqlite_schema where type = 'table';
845845
} db
846846

847847
} {ok 300}
@@ -875,7 +875,7 @@ do_test multipage-schema-autovacuum-shortread {
875875

876876
execsql {
877877
PRAGMA key = 'testkey';
878-
SELECT count(*) FROM sqlite_master where type = 'table';
878+
SELECT count(*) FROM sqlite_schema where type = 'table';
879879
} db
880880

881881
} {ok 300}
@@ -906,7 +906,7 @@ do_test multipage-schema-autovacuum-shortread-wal {
906906

907907
execsql {
908908
PRAGMA key = 'testkey';
909-
SELECT count(*) FROM sqlite_master where type = 'table';
909+
SELECT count(*) FROM sqlite_schema where type = 'table';
910910
} db
911911
} {ok 300}
912912
db close
@@ -1028,7 +1028,7 @@ do_test 2.0-beta-to-2.0-migration {
10281028
PRAGMA cipher_page_size = 1024;
10291029
PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
10301030
PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;
1031-
SELECT count(*) FROM sqlite_master;
1031+
SELECT count(*) FROM sqlite_schema;
10321032

10331033
PRAGMA cipher_hmac_salt_mask = "x'3a'";
10341034
ATTACH DATABASE 'test.db' AS db2 KEY 'testkey';
@@ -1060,7 +1060,7 @@ do_test migrate-1.1.8-database-to-current-format {
10601060
sqlite_orig db test.db
10611061
execsql {
10621062
PRAGMA key = 'testkey';
1063-
SELECT count(*) FROM sqlite_master;
1063+
SELECT count(*) FROM sqlite_schema;
10641064
}
10651065
} {ok 1}
10661066
db close
@@ -1078,7 +1078,7 @@ do_test migrate-2-0-le-database-to-current-format {
10781078
sqlite_orig db test.db
10791079
execsql {
10801080
PRAGMA key = 'testkey';
1081-
SELECT count(*) FROM sqlite_master;
1081+
SELECT count(*) FROM sqlite_schema;
10821082
}
10831083
} {ok 1}
10841084
db close
@@ -1096,7 +1096,7 @@ do_test migrate-3-0-database-to-current-format {
10961096
sqlite_orig db test.db
10971097
execsql {
10981098
PRAGMA key = 'testkey';
1099-
SELECT count(*) FROM sqlite_master;
1099+
SELECT count(*) FROM sqlite_schema;
11001100
PRAGMA journal_mode;
11011101
}
11021102
} {ok 1 delete}
@@ -1126,7 +1126,7 @@ do_test migrate-wal-database-to-current {
11261126
sqlite_orig db test.db
11271127
lappend rc [execsql {
11281128
PRAGMA key = 'testkey';
1129-
SELECT count(*) FROM sqlite_master;
1129+
SELECT count(*) FROM sqlite_schema;
11301130
PRAGMA journal_mode;
11311131
}]
11321132
} {{ok wal} {ok 0 wal} {ok 1 wal}}

test/sqlcipher-core.test

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ do_test will-open-with-correct-raw-key {
4949
sqlite_orig db test.db
5050
execsql {
5151
PRAGMA key = "x'98483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C4836481'";
52-
SELECT name FROM sqlite_master WHERE type='table';
52+
SELECT name FROM sqlite_schema WHERE type='table';
5353
SELECT * from t1;
5454
}
5555
} {ok t1 test1 test2}
@@ -67,7 +67,7 @@ do_test will-open-with-correct-derived-key {
6767
sqlite_orig db test.db
6868
execsql {
6969
PRAGMA key = 'testkey';
70-
SELECT name FROM sqlite_master WHERE type='table';
70+
SELECT name FROM sqlite_schema WHERE type='table';
7171
SELECT * from t1;
7272
}
7373
} {ok t1 test1 test2}
@@ -112,7 +112,7 @@ setup test.db "'testkey'"
112112
do_test wont-open-without-key {
113113
sqlite_orig db test.db
114114
catchsql {
115-
SELECT name FROM sqlite_master WHERE type='table';
115+
SELECT name FROM sqlite_schema WHERE type='table';
116116
}
117117
} {1 {file is not a database}}
118118
db close
@@ -126,7 +126,7 @@ do_test wont-open-with-invalid-derived-key {
126126
sqlite_orig db test.db
127127
catchsql {
128128
PRAGMA key = 'testkey2';
129-
SELECT name FROM sqlite_master WHERE type='table';
129+
SELECT name FROM sqlite_schema WHERE type='table';
130130
}
131131
} {1 {file is not a database}}
132132
db close
@@ -140,7 +140,7 @@ do_test wont-open-with-invalid-raw-key {
140140
sqlite_orig db test.db
141141
catchsql {
142142
PRAGMA key = "x'98483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C4836480'";
143-
SELECT name FROM sqlite_master WHERE type='table';
143+
SELECT name FROM sqlite_schema WHERE type='table';
144144
}
145145
} {1 {file is not a database}}
146146
db close
@@ -525,7 +525,7 @@ do_test custom-pagesize-must-match {
525525
sqlite_orig db test.db
526526
catchsql {
527527
PRAGMA key = 'testkey';
528-
SELECT name FROM sqlite_master WHERE type='table';
528+
SELECT name FROM sqlite_schema WHERE type='table';
529529
}
530530
} {1 {file is not a database}}
531531
db close
@@ -575,21 +575,21 @@ do_test multiple-key-calls-safe-1 {
575575
execsql {
576576
PRAGMA key = 'testkey';
577577
PRAGMA cache_size = 0;
578-
SELECT name FROM sqlite_master WHERE type='table';
578+
SELECT name FROM sqlite_schema WHERE type='table';
579579
}
580580
} {ok t1}
581581

582582
do_test multiple-key-calls-safe-2 {
583583
catchsql {
584584
PRAGMA key = 'wrong key';
585-
SELECT name FROM sqlite_master WHERE type='table';
585+
SELECT name FROM sqlite_schema WHERE type='table';
586586
}
587587
} {1 {file is not a database}}
588588

589589
do_test multiple-key-calls-safe-3 {
590590
execsql {
591591
PRAGMA key = 'testkey';
592-
SELECT name FROM sqlite_master WHERE type='table';
592+
SELECT name FROM sqlite_schema WHERE type='table';
593593
}
594594
} {ok t1}
595595

@@ -640,7 +640,7 @@ do_test custom-hmac-kdf-iter-must-match {
640640
sqlite_orig db test.db
641641
catchsql {
642642
PRAGMA key = 'testkey';
643-
SELECT name FROM sqlite_master WHERE type='table';
643+
SELECT name FROM sqlite_schema WHERE type='table';
644644
}
645645
} {1 {file is not a database}}
646646
db close

test/sqlcipher-rekey.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ do_test rekey-as-first-operation {
118118
sqlite_orig db test.db
119119
execsql {
120120
PRAGMA key = 'testkeynew';
121-
SELECT name FROM sqlite_master WHERE type='table';
121+
SELECT name FROM sqlite_schema WHERE type='table';
122122
}
123123
} {ok t1}
124124
db close

0 commit comments

Comments
 (0)