1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Further refactoring of the schema table name.

FossilOrigin-Name: 9536fa0ae0c1ae6e2e98d2fa11e5acda7f3c9b8ca5061b6f7f8cae63a11d936b
This commit is contained in:
drh
2020-06-19 13:33:53 +00:00
parent ccb2113a62
commit 1e32bed3c1
22 changed files with 115 additions and 104 deletions

View File

@@ -1,6 +1,6 @@
B fd5abb1a7b5a55127d5c0d5ff448020d8bccab44e4f5afe1eb88fc19578af735 B fd5abb1a7b5a55127d5c0d5ff448020d8bccab44e4f5afe1eb88fc19578af735
C Refactoring\svarious\snames.\s\sNo\schanges\sin\sthe\sresulting\smachine\scode. C Further\srefactoring\sof\sthe\sschema\stable\sname.
D 2020-06-19T11:34:57.555 D 2020-06-19T13:33:53.958
F configure f594931bd7b23dad12db96b81e1dba43b41b30a4560d6eb008014e3d9f1617e8 x F configure f594931bd7b23dad12db96b81e1dba43b41b30a4560d6eb008014e3d9f1617e8 x
F configure.ac 13e4ecf89214c3aa0ba099a9e0178f13f03261ace627126737d8cee240ec5c1c F configure.ac 13e4ecf89214c3aa0ba099a9e0178f13f03261ace627126737d8cee240ec5c1c
F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d
@@ -8,15 +8,18 @@ F ext/fts3/fts3.c b0e864379ff9bdc375b6a1c5e401f79f993cc9387978aa11ba87b0c1ef73ce
F ext/session/session_common.tcl f613174665456b2d916ae8df3e5735092a1c1712f36f46840172e9a01e8cc53e F ext/session/session_common.tcl f613174665456b2d916ae8df3e5735092a1c1712f36f46840172e9a01e8cc53e
F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25 F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25
F ext/session/sqlite3session.c fc8c6c13dc0456943ff24abf574ced10418eec66a548c97d3eafbebe9fc5e908 F ext/session/sqlite3session.c fc8c6c13dc0456943ff24abf574ced10418eec66a548c97d3eafbebe9fc5e908
F src/alter.c b8ffe4acd48b4fe793d01901f28fd4f3b037854a0e99f0c977738556c31b9d2b F src/alter.c f6cf5c21f92ad59159a6c44214942efe1433389887851ca25ac0a4a658e0694b
F src/btree.c d9d7813a28f9c337908858aa46d6129d43cd790bc87c62146cd6915bb412150c F src/btree.c fe9c4c68d74f0cd6e45d942b526eab8088eb319411c9dc4265750e490f2aeaef
F src/btreeInt.h 401f0549caa02cce8791baeb673aa570ee35c89ce53a7628a3d21804784c23d0 F src/btreeInt.h 401f0549caa02cce8791baeb673aa570ee35c89ce53a7628a3d21804784c23d0
F src/build.c 8245e69aa1a2f8b67e76203fdbaa9f88deccd89b5ed41f7097c202b920484fd0 F src/build.c c24ba2811c00b52a9ffaea11a11b1c022335e39d85e4612e90a1fa098466af1d
F src/date.c 9f1d31ef1bfdc732a83459e05770f6d5aeb57a7e323b48f1798cb870125601ef F src/date.c 9f1d31ef1bfdc732a83459e05770f6d5aeb57a7e323b48f1798cb870125601ef
F src/expr.c 36bb737d2ca78ee9bd4fde46cf1e51a37e7e1b263e55fccfaef32922a19e9524 F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c afca63b2281882ec1d54d0330fc57d7878fe1383c59f6b84a46e60fb13ed8896
F src/expr.c c6b723ffef4ba27669cc5fd333857027cb2e2836f5fc4fc607843bd9120f80ec
F src/global.c 0409ae635839e0bef26a69b68be64126ab6cba62ac19bd7694f1652e591c4c17 F src/global.c 0409ae635839e0bef26a69b68be64126ab6cba62ac19bd7694f1652e591c4c17
F src/insert.c c05a7c6f3dbb1a00360b51deac590d4977413078a98334e1650f43223a7d2fc6
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47 F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
F src/main.c 84b2ddb649a4fb470abaa980ff41242819812b6a6c08fc0baa2c024b175bc76b F src/main.c 90387ccf7b1ad6589ec360f0aca8213ae12291463e2dfc55d621161b954aa0bb
F src/mutex_unix.c dd2b3f1cc1863079bc1349ac0fec395a500090c4fe4e11ab775310a49f2f956d F src/mutex_unix.c dd2b3f1cc1863079bc1349ac0fec395a500090c4fe4e11ab775310a49f2f956d
F src/mutex_w32.c caa50e1c0258ac4443f52e00fe8aaea73b6d0728bd8856bedfff822cae418541 F src/mutex_w32.c caa50e1c0258ac4443f52e00fe8aaea73b6d0728bd8856bedfff822cae418541
F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6 F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6
@@ -24,31 +27,39 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os_unix.c 94bd41f5c058db79ccdf7c51627b8917d98423c0899ec5e5b9b3a6fd36e8b2ff F src/os_unix.c 94bd41f5c058db79ccdf7c51627b8917d98423c0899ec5e5b9b3a6fd36e8b2ff
F src/os_win.c 92f7ed3dd12fcc30b65815fa524fb7c4c6f9a1c9aa44c4b7c46759fc42f66105 F src/os_win.c 92f7ed3dd12fcc30b65815fa524fb7c4c6f9a1c9aa44c4b7c46759fc42f66105
F src/pager.c 7d6cff7a2aca0aacedb15eb67b4a7fb67c39725a1e02d1a6a7bb6573a61a51a1 F src/pager.c 7d6cff7a2aca0aacedb15eb67b4a7fb67c39725a1e02d1a6a7bb6573a61a51a1
F src/prepare.c ea06beff2fd51f8e9ebb2c70f915b517d082b1dddae69d3f2922f89d077cb248
F src/select.c 6ddd86a7272ff1f443bd9efcbb0f5ab590674d4c732e4cb8c3d5dd8e3a70cae6 F src/select.c 6ddd86a7272ff1f443bd9efcbb0f5ab590674d4c732e4cb8c3d5dd8e3a70cae6
F src/shell.c.in ffd3de9cb7294919fe1b56c49f9d62fc4b049015c4727c934f3d1880128c56e3 F src/shell.c.in ffd3de9cb7294919fe1b56c49f9d62fc4b049015c4727c934f3d1880128c56e3
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqliteInt.h 5f9b119efd2c628780b5cfb628170c6c2393a1ca46e75b0fe83abb9660bf02c9 F src/sqliteInt.h 5f9b119efd2c628780b5cfb628170c6c2393a1ca46e75b0fe83abb9660bf02c9
F src/test1.c 8442b50ecbbce891a9e490e54879e6bcc540590be591451c296ec6c57640847d F src/test1.c 8442b50ecbbce891a9e490e54879e6bcc540590be591451c296ec6c57640847d
F src/test8.c 7fb971777c2c79c734bb52757191d68d4af659b8de9b4a071be3f527a9d19a02
F src/test_multiplex.c d0ee44ec77687b35e83fd6b9fca4c5860f603b1b407fd375be62437b79af5ae3 F src/test_multiplex.c d0ee44ec77687b35e83fd6b9fca4c5860f603b1b407fd375be62437b79af5ae3
F src/test_mutex.c abf486e91bd65e2448027d4bb505e7cce6ba110e1afb9bd348d1996961cadf0d
F src/test_osinst.c d341f9d7613e007c8c3f7eba6cd307230047506aa8f97858c1fd21f5069616bd F src/test_osinst.c d341f9d7613e007c8c3f7eba6cd307230047506aa8f97858c1fd21f5069616bd
F src/trigger.c 6b1472e6b5bbca71e13f95c61ebcd0b255450352de8254a42c40222020b7ac43 F src/test_schema.c f5d6067dfc2f2845c4dd56df63e66ee826fb23877855c785f75cc2ca83fd0c1b
F src/vacuum.c b196258ea36cfed5f455f18519345613bab04daf0e038a63ee715407c5a7ae9e F src/trigger.c 58721162a3ee608ae0d824b0eededbf9b7ebc038dd49aff879b05d44ad16ef10
F src/vdbe.c 985f92b5131d62654c3c26062a2e55b1c8f71c2e10497e23021c6650d5c392b3 F src/update.c a5b501b746af515cad62fed820a754801a5aca8f1ae413d081f50b8fa4e846d6
F src/vacuum.c 1c4f8e2f39d950037f4cf946b6858c993d3a54c3101f78e05c76460a073afcf0
F src/vdbe.c ab55c09651ab46e1636df11f6a407353c61c31fd9cc05b4d4bc2021b6cd01722
F src/vdbeaux.c 4c4716795d47505e25e209c45f3448810d1458fee5210fd1e3759557872de10e F src/vdbeaux.c 4c4716795d47505e25e209c45f3448810d1458fee5210fd1e3759557872de10e
F src/vtab.c 33ecf1d8b0fd1508fe23be9da40e48909c86a13db2725e273177eb47db2fc265 F src/vtab.c 5f5fc793092f53bbdfde296c50f563fb7bda58cf48e9cf6a8bdfbc5abd409845
F src/window.c 88a63e6948ea924b3cf9ad8aff5ea1fa53bebdb2f13340867205fda16ed0f19c F src/window.c 88a63e6948ea924b3cf9ad8aff5ea1fa53bebdb2f13340867205fda16ed0f19c
F test/corruptL.test 16564fa7961fcce242945177c9bdaa5cb5dc85d6248612dbe4b927d059eb6014 F test/corruptL.test 16564fa7961fcce242945177c9bdaa5cb5dc85d6248612dbe4b927d059eb6014
F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c7880bb0c67d0 F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c7880bb0c67d0
F test/fts3corrupt4.test 4664c72bb49400b6f3d86627760129ee7962e4834869909c55037ff21ccd36b8 F test/fts3corrupt4.test 4664c72bb49400b6f3d86627760129ee7962e4834869909c55037ff21ccd36b8
F test/fuzzdata8.db e7a6a1444adb7bd10dec870234979ddd63173314c7345e3def2d892dcf99d48f F test/fuzzdata8.db e7a6a1444adb7bd10dec870234979ddd63173314c7345e3def2d892dcf99d48f
F test/istrue.test 06f92ea38750fa74df7dbbe6920205251c2310861fbbe23a3adfa918a2e2ba74 F test/istrue.test 06f92ea38750fa74df7dbbe6920205251c2310861fbbe23a3adfa918a2e2ba74
F test/mutex1.test 177db2e4edb530f2ff21edc52ac79a412dbe63e4c47c3ae9504d3fb4f1ce81fa
F test/select3.test c49fbb758903f3718e2de5aa4655eda4838131cbea24a86db908f8b6889aa68c F test/select3.test c49fbb758903f3718e2de5aa4655eda4838131cbea24a86db908f8b6889aa68c
F test/selectA.test 68de52409e45a3313d00b8461b48bef4fb729faf36ade9067a994eae55cc86f4 F test/selectA.test 68de52409e45a3313d00b8461b48bef4fb729faf36ade9067a994eae55cc86f4
F test/stat.test 15a3106eddedfc882f64bc09f237b4169be4b92dd57c93031b8ff8b13af3e7c5
F test/where.test f5e62453537e5b335b69f3b09f8a02ce3328289fad5d866e25371284b837d78d F test/where.test f5e62453537e5b335b69f3b09f8a02ce3328289fad5d866e25371284b837d78d
F test/whereG.test 9363b2a97d914cb1b81aff5069ef0cf2a071a67e2b604eac6fe9c0114017d9aa F test/whereG.test 9363b2a97d914cb1b81aff5069ef0cf2a071a67e2b604eac6fe9c0114017d9aa
F test/window1.test 9d7f4990e5b36d95af93b189da4aa75216c6690ce95cced3c8b6d3234be51c2c F test/window1.test 9d7f4990e5b36d95af93b189da4aa75216c6690ce95cced3c8b6d3234be51c2c
F test/without_rowid3.test 96426a6c9a2a5cf62bbe55ea1ad038eaaf4bf743f40a1ad517233b8e5a3d4339 F test/without_rowid3.test 96426a6c9a2a5cf62bbe55ea1ad038eaaf4bf743f40a1ad517233b8e5a3d4339
P 4a340c9bc7d939efc947e3b17ca79314482f74368b15567dd089d40e4270890e F tool/spaceanal.tcl a95036b36622e25cffd65a55b22d6af53dfbbff0de02d45dd0059bb3c9978609
R 9833b56461d0ff6ff79be23099c8a427 P 7bb08b1bfcf184e4b59c8c9028926a0052612ff6a6731914ccdb8dee07ea4a98
R 242b0a7d6e265556b8adaffe4a522b0a
U drh U drh
Z 362d8b86a61aefc35e02371751514139 Z c8cfc1a2032a3250ca40813d0975c88e

View File

@@ -1 +1 @@
7bb08b1bfcf184e4b59c8c9028926a0052612ff6a6731914ccdb8dee07ea4a98 9536fa0ae0c1ae6e2e98d2fa11e5acda7f3c9b8ca5061b6f7f8cae63a11d936b

View File

@@ -192,7 +192,7 @@ void sqlite3AlterRenameTable(
, zDb, zDb, zTabName, zName, (iDb==1), zTabName , zDb, zDb, zTabName, zName, (iDb==1), zTabName
); );
/* Update the tbl_name and name columns of the sqlite_master table /* Update the tbl_name and name columns of the sqlite_schema table
** as required. */ ** as required. */
sqlite3NestedParse(pParse, sqlite3NestedParse(pParse,
"UPDATE %Q." DFLT_SCHEMA_TABLE " SET " "UPDATE %Q." DFLT_SCHEMA_TABLE " SET "
@@ -226,7 +226,7 @@ void sqlite3AlterRenameTable(
** as required. */ ** as required. */
if( iDb!=1 ){ if( iDb!=1 ){
sqlite3NestedParse(pParse, sqlite3NestedParse(pParse,
"UPDATE sqlite_temp_master SET " "UPDATE sqlite_temp_schema SET "
"sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
"tbl_name = " "tbl_name = "
"CASE WHEN tbl_name=%Q COLLATE nocase AND " "CASE WHEN tbl_name=%Q COLLATE nocase AND "
@@ -587,7 +587,7 @@ void sqlite3AlterRenameColumn(
/* Do the rename operation using a recursive UPDATE statement that /* Do the rename operation using a recursive UPDATE statement that
** uses the sqlite_rename_column() SQL function to compute the new ** uses the sqlite_rename_column() SQL function to compute the new
** CREATE statement text for the sqlite_master table. ** CREATE statement text for the sqlite_schema table.
*/ */
sqlite3MayAbort(pParse); sqlite3MayAbort(pParse);
zNew = sqlite3NameFromToken(db, pNew); zNew = sqlite3NameFromToken(db, pNew);

View File

@@ -357,7 +357,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
/* A connection with the read-uncommitted flag set will never try to /* A connection with the read-uncommitted flag set will never try to
** obtain a read-lock using this function. The only read-lock obtained ** obtain a read-lock using this function. The only read-lock obtained
** by a connection in read-uncommitted mode is on the sqlite_master ** by a connection in read-uncommitted mode is on the sqlite_schema
** table, and that lock is obtained in BtreeBeginTrans(). */ ** table, and that lock is obtained in BtreeBeginTrans(). */
assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK ); assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK );
@@ -10356,7 +10356,7 @@ void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
/* /*
** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared ** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared
** btree as the argument handle holds an exclusive lock on the ** btree as the argument handle holds an exclusive lock on the
** sqlite_master table. Otherwise SQLITE_OK. ** sqlite_schema table. Otherwise SQLITE_OK.
*/ */
int sqlite3BtreeSchemaLocked(Btree *p){ int sqlite3BtreeSchemaLocked(Btree *p){
int rc; int rc;

View File

@@ -763,7 +763,7 @@ char *sqlite3NameFromToken(sqlite3 *db, Token *pName){
} }
/* /*
** Open the sqlite_master table stored in database number iDb for ** Open the sqlite_schema table stored in database number iDb for
** writing. The table is opened using cursor 0. ** writing. The table is opened using cursor 0.
*/ */
void sqlite3OpenSchemaTable(Parse *p, int iDb){ void sqlite3OpenSchemaTable(Parse *p, int iDb){
@@ -877,7 +877,7 @@ int sqlite3WritableSchema(sqlite3 *db){
** "sqlite_" (in upper, lower or mixed case). This portion of the namespace ** "sqlite_" (in upper, lower or mixed case). This portion of the namespace
** is reserved for internal use. ** is reserved for internal use.
** **
** When parsing the sqlite_master table, this routine also checks to ** When parsing the sqlite_schema table, this routine also checks to
** make sure the "type", "name", and "tbl_name" columns are consistent ** make sure the "type", "name", and "tbl_name" columns are consistent
** with the SQL. ** with the SQL.
*/ */
@@ -1049,7 +1049,7 @@ void sqlite3StartTable(
Token *pName; /* Unqualified name of the table to create */ Token *pName; /* Unqualified name of the table to create */
if( db->init.busy && db->init.newTnum==1 ){ if( db->init.busy && db->init.newTnum==1 ){
/* Special case: Parsing the sqlite_master or sqlite_temp_master schema */ /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */
iDb = db->init.iDb; iDb = db->init.iDb;
zName = sqlite3DbStrDup(db, SCHEMA_TABLE(iDb)); zName = sqlite3DbStrDup(db, SCHEMA_TABLE(iDb));
pName = pName1; pName = pName1;
@@ -1191,7 +1191,7 @@ void sqlite3StartTable(
sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, ENC(db)); sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, ENC(db));
sqlite3VdbeJumpHere(v, addr1); sqlite3VdbeJumpHere(v, addr1);
/* This just creates a place-holder record in the sqlite_master table. /* This just creates a place-holder record in the sqlite_schema table.
** The record created does not contain anything yet. It will be replaced ** The record created does not contain anything yet. It will be replaced
** by the real entry in code generated at sqlite3EndTable(). ** by the real entry in code generated at sqlite3EndTable().
** **
@@ -2019,9 +2019,9 @@ static void recomputeColumnsNotIndexed(Index *pIdx){
** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. ** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL.
** (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY ** (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY
** into BTREE_BLOBKEY. ** into BTREE_BLOBKEY.
** (3) Bypass the creation of the sqlite_master table entry ** (3) Bypass the creation of the sqlite_schema table entry
** for the PRIMARY KEY as the primary key index is now ** for the PRIMARY KEY as the primary key index is now
** identified by the sqlite_master table entry of the table itself. ** identified by the sqlite_schema table entry of the table itself.
** (4) Set the Index.tnum of the PRIMARY KEY Index object in the ** (4) Set the Index.tnum of the PRIMARY KEY Index object in the
** schema to the rootpage from the main table. ** schema to the rootpage from the main table.
** (5) Add all table columns to the PRIMARY KEY Index object ** (5) Add all table columns to the PRIMARY KEY Index object
@@ -2108,7 +2108,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
if( !db->init.imposterTable ) pPk->uniqNotNull = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
nPk = pPk->nColumn = pPk->nKeyCol; nPk = pPk->nColumn = pPk->nKeyCol;
/* Bypass the creation of the PRIMARY KEY btree and the sqlite_master /* Bypass the creation of the PRIMARY KEY btree and the sqlite_schema
** table entry. This is only required if currently generating VDBE ** table entry. This is only required if currently generating VDBE
** code for a CREATE TABLE (not when parsing one as part of reading ** code for a CREATE TABLE (not when parsing one as part of reading
** a database schema). */ ** a database schema). */
@@ -2258,10 +2258,10 @@ static void markExprListImmutable(ExprList *pList){
** **
** An entry for the table is made in the master table on disk, unless ** An entry for the table is made in the master table on disk, unless
** this is a temporary table or db->init.busy==1. When db->init.busy==1 ** this is a temporary table or db->init.busy==1. When db->init.busy==1
** it means we are reading the sqlite_master table because we just ** it means we are reading the sqlite_schema table because we just
** connected to the database or because the sqlite_master table has ** connected to the database or because the sqlite_schema table has
** recently changed, so the entry for this table already exists in ** recently changed, so the entry for this table already exists in
** the sqlite_master table. We do not want to create it again. ** the sqlite_schema table. We do not want to create it again.
** **
** If the pSelect argument is not NULL, it means that this routine ** If the pSelect argument is not NULL, it means that this routine
** was called to create a table generated from a ** was called to create a table generated from a
@@ -2292,12 +2292,12 @@ void sqlite3EndTable(
} }
/* If the db->init.busy is 1 it means we are reading the SQL off the /* If the db->init.busy is 1 it means we are reading the SQL off the
** "sqlite_master" or "sqlite_temp_master" table on the disk. ** "sqlite_schema" or "sqlite_temp_schema" table on the disk.
** So do not write to the disk again. Extract the root page number ** So do not write to the disk again. Extract the root page number
** for the table from the db->init.newTnum field. (The page number ** for the table from the db->init.newTnum field. (The page number
** should have been put there by the sqliteOpenCb routine.) ** should have been put there by the sqliteOpenCb routine.)
** **
** If the root page number is 1, that means this is the sqlite_master ** If the root page number is 1, that means this is the sqlite_schema
** table itself. So mark it read-only. ** table itself. So mark it read-only.
*/ */
if( db->init.busy ){ if( db->init.busy ){
@@ -2836,7 +2836,7 @@ void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){
/* /*
** Write code to erase the table with root-page iTable from database iDb. ** Write code to erase the table with root-page iTable from database iDb.
** Also write code to modify the sqlite_master table and internal schema ** Also write code to modify the sqlite_schema table and internal schema
** if a root-page of another table is moved by the btree-layer whilst ** if a root-page of another table is moved by the btree-layer whilst
** erasing iTable (this can happen with an auto-vacuum database). ** erasing iTable (this can happen with an auto-vacuum database).
*/ */
@@ -2849,7 +2849,7 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM
/* OP_Destroy stores an in integer r1. If this integer /* OP_Destroy stores an in integer r1. If this integer
** is non-zero, then it is the root page number of a table moved to ** is non-zero, then it is the root page number of a table moved to
** location iTable. The following code modifies the sqlite_master table to ** location iTable. The following code modifies the sqlite_schema table to
** reflect this. ** reflect this.
** **
** The "#NNN" in the SQL is a special constant that means whatever value ** The "#NNN" in the SQL is a special constant that means whatever value
@@ -2866,7 +2866,7 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){
/* /*
** Write VDBE code to erase table pTab and all associated indices on disk. ** Write VDBE code to erase table pTab and all associated indices on disk.
** Code to update the sqlite_master tables and internal schema definitions ** Code to update the sqlite_schema tables and internal schema definitions
** in case a root-page belonging to another table is moved by the btree layer ** in case a root-page belonging to another table is moved by the btree layer
** is also added (this can happen with an auto-vacuum database). ** is also added (this can happen with an auto-vacuum database).
*/ */
@@ -2959,8 +2959,8 @@ void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
#endif #endif
/* Drop all triggers associated with the table being dropped. Code /* Drop all triggers associated with the table being dropped. Code
** is generated to remove entries from sqlite_master and/or ** is generated to remove entries from sqlite_schema and/or
** sqlite_temp_master if required. ** sqlite_temp_schema if required.
*/ */
pTrigger = sqlite3TriggerList(pParse, pTab); pTrigger = sqlite3TriggerList(pParse, pTab);
while( pTrigger ){ while( pTrigger ){
@@ -3609,7 +3609,7 @@ void sqlite3CreateIndex(
** index or table with the same name. ** index or table with the same name.
** **
** Exception: If we are reading the names of permanent indices from the ** Exception: If we are reading the names of permanent indices from the
** sqlite_master table (because some other process changed the schema) and ** sqlite_schema table (because some other process changed the schema) and
** one of the index names collides with the name of a temporary table or ** one of the index names collides with the name of a temporary table or
** index, then we will continue to process this index. ** index, then we will continue to process this index.
** **
@@ -3953,8 +3953,8 @@ void sqlite3CreateIndex(
/* If this is the initial CREATE INDEX statement (or CREATE TABLE if the /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the
** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then
** emit code to allocate the index rootpage on disk and make an entry for ** emit code to allocate the index rootpage on disk and make an entry for
** the index in the sqlite_master table and populate the index with ** the index in the sqlite_schema table and populate the index with
** content. But, do not do this if we are simply reading the sqlite_master ** content. But, do not do this if we are simply reading the sqlite_schema
** table to parse the schema, or if this index is the PRIMARY KEY index ** table to parse the schema, or if this index is the PRIMARY KEY index
** of a WITHOUT ROWID table. ** of a WITHOUT ROWID table.
** **
@@ -3998,7 +3998,7 @@ void sqlite3CreateIndex(
zStmt = 0; zStmt = 0;
} }
/* Add an entry in sqlite_master for this index /* Add an entry in sqlite_schema for this index
*/ */
sqlite3NestedParse(pParse, sqlite3NestedParse(pParse,
"INSERT INTO %Q." DFLT_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);", "INSERT INTO %Q." DFLT_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",

View File

@@ -724,10 +724,10 @@ static int statFilter(
pSql = sqlite3_str_new(pTab->db); pSql = sqlite3_str_new(pTab->db);
sqlite3_str_appendf(pSql, sqlite3_str_appendf(pSql,
"SELECT * FROM (" "SELECT * FROM ("
"SELECT 'sqlite_master' AS name,1 AS rootpage,'table' AS type" "SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type"
" UNION ALL " " UNION ALL "
"SELECT name,rootpage,type" "SELECT name,rootpage,type"
" FROM \"%w\".sqlite_master WHERE rootpage!=0)", " FROM \"%w\".sqlite_schema WHERE rootpage!=0)",
pTab->db->aDb[pCsr->iDb].zDbSName); pTab->db->aDb[pCsr->iDb].zDbSName);
if( zName ){ if( zName ){
sqlite3_str_appendf(pSql, "WHERE name=%Q", zName); sqlite3_str_appendf(pSql, "WHERE name=%Q", zName);

View File

@@ -51,7 +51,7 @@ Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
** 1) It is a virtual table and no implementation of the xUpdate method ** 1) It is a virtual table and no implementation of the xUpdate method
** has been provided ** has been provided
** **
** 2) It is a system table (i.e. sqlite_master), this call is not ** 2) It is a system table (i.e. sqlite_schema), this call is not
** part of a nested parse and writable_schema pragma has not ** part of a nested parse and writable_schema pragma has not
** been specified ** been specified
** **

View File

@@ -1993,10 +1993,10 @@ Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
** **
** The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT ** The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT
** expressions in a CREATE TABLE statement. The Walker.eCode value is 5 ** expressions in a CREATE TABLE statement. The Walker.eCode value is 5
** when parsing an existing schema out of the sqlite_master table and 4 ** when parsing an existing schema out of the sqlite_schema table and 4
** when processing a new CREATE TABLE statement. A bound parameter raises ** when processing a new CREATE TABLE statement. A bound parameter raises
** an error for new statements, but is silently converted ** an error for new statements, but is silently converted
** to NULL for existing schemas. This allows sqlite_master tables that ** to NULL for existing schemas. This allows sqlite_schema tables that
** contain a bound parameter because they were generated by older versions ** contain a bound parameter because they were generated by older versions
** of SQLite to be parsed by newer versions of SQLite without raising a ** of SQLite to be parsed by newer versions of SQLite without raising a
** malformed schema error. ** malformed schema error.
@@ -2058,7 +2058,7 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
if( pWalker->eCode==5 ){ if( pWalker->eCode==5 ){
/* Silently convert bound parameters that appear inside of CREATE /* Silently convert bound parameters that appear inside of CREATE
** statements into a NULL when parsing the CREATE statement text out ** statements into a NULL when parsing the CREATE statement text out
** of the sqlite_master table */ ** of the sqlite_schema table */
pExpr->op = TK_NULL; pExpr->op = TK_NULL;
}else if( pWalker->eCode==4 ){ }else if( pWalker->eCode==4 ){
/* A bound parameter in a CREATE statement that originates from /* A bound parameter in a CREATE statement that originates from
@@ -2191,12 +2191,12 @@ int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){
** the expression is constant or a function call with constant arguments. ** the expression is constant or a function call with constant arguments.
** Return and 0 if there are any variables. ** Return and 0 if there are any variables.
** **
** isInit is true when parsing from sqlite_master. isInit is false when ** isInit is true when parsing from sqlite_schema. isInit is false when
** processing a new CREATE TABLE statement. When isInit is true, parameters ** processing a new CREATE TABLE statement. When isInit is true, parameters
** (such as ? or $abc) in the expression are converted into NULL. When ** (such as ? or $abc) in the expression are converted into NULL. When
** isInit is false, parameters raise an error. Parameters should not be ** isInit is false, parameters raise an error. Parameters should not be
** allowed in a CREATE TABLE statement, but some legacy versions of SQLite ** allowed in a CREATE TABLE statement, but some legacy versions of SQLite
** allowed it, so we need to support it when reading sqlite_master for ** allowed it, so we need to support it when reading sqlite_schema for
** backwards compatibility. ** backwards compatibility.
** **
** If isInit is true, set EP_FromDDL on every TK_FUNCTION node. ** If isInit is true, set EP_FromDDL on every TK_FUNCTION node.

View File

@@ -2610,7 +2610,7 @@ static int xferOptimization(
return 0; /* FROM clause does not contain a real table */ return 0; /* FROM clause does not contain a real table */
} }
if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){ if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){
testcase( pSrc!=pDest ); /* Possible due to bad sqlite_master.rootpage */ testcase( pSrc!=pDest ); /* Possible due to bad sqlite_schema.rootpage */
return 0; /* tab1 and tab2 may not be the same table */ return 0; /* tab1 and tab2 may not be the same table */
} }
if( HasRowid(pDest)!=HasRowid(pSrc) ){ if( HasRowid(pDest)!=HasRowid(pSrc) ){

View File

@@ -4089,7 +4089,7 @@ int sqlite3_test_control(int op, ...){
/* sqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int); /* sqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int);
** **
** Set or clear a flag that causes SQLite to verify that type, name, ** Set or clear a flag that causes SQLite to verify that type, name,
** and tbl_name fields of the sqlite_master table. This is normally ** and tbl_name fields of the sqlite_schema table. This is normally
** on, but it is sometimes useful to turn it off for testing. ** on, but it is sometimes useful to turn it off for testing.
*/ */
case SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: { case SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: {

View File

@@ -189,8 +189,8 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){
db->init.busy = 1; db->init.busy = 1;
/* Construct the in-memory representation schema tables (sqlite_master or /* Construct the in-memory representation schema tables (sqlite_schema or
** sqlite_temp_master) by invoking the parser directly. The appropriate ** sqlite_temp_schema) by invoking the parser directly. The appropriate
** table name will be inserted automatically by the parser so we can just ** table name will be inserted automatically by the parser so we can just
** use the abbreviation "x" here. The parser will also automatically tag ** use the abbreviation "x" here. The parser will also automatically tag
** the schema table as read-only. */ ** the schema table as read-only. */
@@ -363,7 +363,7 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){
** current sqlite3_prepare() operation will fail, but the following one ** current sqlite3_prepare() operation will fail, but the following one
** will attempt to compile the supplied statement against whatever subset ** will attempt to compile the supplied statement against whatever subset
** of the schema was loaded before the error occurred. The primary ** of the schema was loaded before the error occurred. The primary
** purpose of this is to allow access to the sqlite_master table ** purpose of this is to allow access to the sqlite_schema table
** even when its contents have been corrupted. ** even when its contents have been corrupted.
*/ */
DbSetProperty(db, iDb, DB_SchemaLoaded); DbSetProperty(db, iDb, DB_SchemaLoaded);
@@ -743,7 +743,7 @@ static int sqlite3LockAndPrepare(
** **
** If the statement is successfully recompiled, return SQLITE_OK. Otherwise, ** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,
** if the statement cannot be recompiled because another connection has ** if the statement cannot be recompiled because another connection has
** locked the sqlite3_master table, return SQLITE_LOCKED. If any other error ** locked the sqlite3_schema table, return SQLITE_LOCKED. If any other error
** occurs, return SQLITE_SCHEMA. ** occurs, return SQLITE_SCHEMA.
*/ */
int sqlite3Reprepare(Vdbe *p){ int sqlite3Reprepare(Vdbe *p){

View File

@@ -341,7 +341,7 @@ static int echoDeclareVtab(
if( pVtab->zTableName ){ if( pVtab->zTableName ){
sqlite3_stmt *pStmt = 0; sqlite3_stmt *pStmt = 0;
rc = sqlite3_prepare(db, rc = sqlite3_prepare(db,
"SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?", "SELECT sql FROM sqlite_schema WHERE type = 'table' AND name = ?",
-1, &pStmt, 0); -1, &pStmt, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
sqlite3_bind_text(pStmt, 1, pVtab->zTableName, -1, 0); sqlite3_bind_text(pStmt, 1, pVtab->zTableName, -1, 0);

View File

@@ -30,7 +30,7 @@
extern const char *sqlite3ErrName(int); extern const char *sqlite3ErrName(int);
static const char *aName[MAX_MUTEXES+1] = { static const char *aName[MAX_MUTEXES+1] = {
"fast", "recursive", "static_master", "static_mem", "fast", "recursive", "static_main", "static_mem",
"static_open", "static_prng", "static_lru", "static_pmem", "static_open", "static_prng", "static_lru", "static_pmem",
"static_app1", "static_app2", "static_app3", "static_vfs1", "static_app1", "static_app2", "static_app3", "static_vfs1",
"static_vfs2", "static_vfs3", 0 "static_vfs2", "static_vfs3", 0

View File

@@ -192,18 +192,18 @@ static int schemaNext(sqlite3_vtab_cursor *cur){
} }
/* Set zSql to the SQL to pull the list of tables from the /* Set zSql to the SQL to pull the list of tables from the
** sqlite_master (or sqlite_temp_master) table of the database ** sqlite_schema (or sqlite_temp_schema) table of the database
** identified by the row pointed to by the SQL statement pCur->pDbList ** identified by the row pointed to by the SQL statement pCur->pDbList
** (iterating through a "PRAGMA database_list;" statement). ** (iterating through a "PRAGMA database_list;" statement).
*/ */
if( sqlite3_column_int(pCur->pDbList, 0)==1 ){ if( sqlite3_column_int(pCur->pDbList, 0)==1 ){
zSql = sqlite3_mprintf( zSql = sqlite3_mprintf(
"SELECT name FROM sqlite_temp_master WHERE type='table'" "SELECT name FROM sqlite_temp_schema WHERE type='table'"
); );
}else{ }else{
sqlite3_stmt *pDbList = pCur->pDbList; sqlite3_stmt *pDbList = pCur->pDbList;
zSql = sqlite3_mprintf( zSql = sqlite3_mprintf(
"SELECT name FROM %Q.sqlite_master WHERE type='table'", "SELECT name FROM %Q.sqlite_schema WHERE type='table'",
sqlite3_column_text(pDbList, 1) sqlite3_column_text(pDbList, 1)
); );
} }

View File

@@ -318,13 +318,13 @@ void sqlite3FinishTrigger(
#endif #endif
/* if we are not initializing, /* if we are not initializing,
** build the sqlite_master entry ** build the sqlite_schema entry
*/ */
if( !db->init.busy ){ if( !db->init.busy ){
Vdbe *v; Vdbe *v;
char *z; char *z;
/* Make an entry in the sqlite_master table */ /* Make an entry in the sqlite_schema table */
v = sqlite3GetVdbe(pParse); v = sqlite3GetVdbe(pParse);
if( v==0 ) goto triggerfinish_cleanup; if( v==0 ) goto triggerfinish_cleanup;
sqlite3BeginWriteOperation(pParse, 0, iDb); sqlite3BeginWriteOperation(pParse, 0, iDb);

View File

@@ -46,7 +46,7 @@ static void updateVirtualTable(
** literal default values specified: a number, null or a string. (If a more ** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated ** complicated default expression value was provided, it is evaluated
** when the ALTER TABLE is executed and one of the literal values written ** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.) ** into the sqlite_schema table.)
** **
** Therefore, the P4 parameter is only required if the default value for ** Therefore, the P4 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr() ** the column is a literal number, string or null. The sqlite3ValueFromExpr()

View File

@@ -41,7 +41,7 @@ static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
assert( sqlite3_strnicmp(zSql,"SELECT",6)==0 ); assert( sqlite3_strnicmp(zSql,"SELECT",6)==0 );
/* The secondary SQL must be one of CREATE TABLE, CREATE INDEX, /* The secondary SQL must be one of CREATE TABLE, CREATE INDEX,
** or INSERT. Historically there have been attacks that first ** or INSERT. Historically there have been attacks that first
** corrupt the sqlite_master.sql field with other kinds of statements ** corrupt the sqlite_schema.sql field with other kinds of statements
** then run VACUUM to get those statements to execute at inappropriate ** then run VACUUM to get those statements to execute at inappropriate
** times. */ ** times. */
if( zSubSql if( zSubSql
@@ -272,14 +272,14 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
*/ */
db->init.iDb = nDb; /* force new CREATE statements into vacuum_db */ db->init.iDb = nDb; /* force new CREATE statements into vacuum_db */
rc = execSqlF(db, pzErrMsg, rc = execSqlF(db, pzErrMsg,
"SELECT sql FROM \"%w\".sqlite_master" "SELECT sql FROM \"%w\".sqlite_schema"
" WHERE type='table'AND name<>'sqlite_sequence'" " WHERE type='table'AND name<>'sqlite_sequence'"
" AND coalesce(rootpage,1)>0", " AND coalesce(rootpage,1)>0",
zDbMain zDbMain
); );
if( rc!=SQLITE_OK ) goto end_of_vacuum; if( rc!=SQLITE_OK ) goto end_of_vacuum;
rc = execSqlF(db, pzErrMsg, rc = execSqlF(db, pzErrMsg,
"SELECT sql FROM \"%w\".sqlite_master" "SELECT sql FROM \"%w\".sqlite_schema"
" WHERE type='index'", " WHERE type='index'",
zDbMain zDbMain
); );
@@ -293,7 +293,7 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
rc = execSqlF(db, pzErrMsg, rc = execSqlF(db, pzErrMsg,
"SELECT'INSERT INTO vacuum_db.'||quote(name)" "SELECT'INSERT INTO vacuum_db.'||quote(name)"
"||' SELECT*FROM\"%w\".'||quote(name)" "||' SELECT*FROM\"%w\".'||quote(name)"
"FROM vacuum_db.sqlite_master " "FROM vacuum_db.sqlite_schema "
"WHERE type='table'AND coalesce(rootpage,1)>0", "WHERE type='table'AND coalesce(rootpage,1)>0",
zDbMain zDbMain
); );
@@ -307,8 +307,8 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
** from the schema table. ** from the schema table.
*/ */
rc = execSqlF(db, pzErrMsg, rc = execSqlF(db, pzErrMsg,
"INSERT INTO vacuum_db.sqlite_master" "INSERT INTO vacuum_db.sqlite_schema"
" SELECT*FROM \"%w\".sqlite_master" " SELECT*FROM \"%w\".sqlite_schema"
" WHERE type IN('view','trigger')" " WHERE type IN('view','trigger')"
" OR(type='table'AND rootpage=0)", " OR(type='table'AND rootpage=0)",
zDbMain zDbMain

View File

@@ -6124,7 +6124,7 @@ case OP_ParseSchema: {
if( rc==SQLITE_OK && initData.nInitRow==0 ){ if( rc==SQLITE_OK && initData.nInitRow==0 ){
/* The OP_ParseSchema opcode with a non-NULL P4 argument should parse /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse
** at least one SQL statement. Any less than that indicates that ** at least one SQL statement. Any less than that indicates that
** the sqlite_master table is corrupt. */ ** the sqlite_schema table is corrupt. */
rc = SQLITE_CORRUPT_BKPT; rc = SQLITE_CORRUPT_BKPT;
} }
sqlite3DbFreeNN(db, zSql); sqlite3DbFreeNN(db, zSql);

View File

@@ -405,7 +405,7 @@ void sqlite3VtabBeginParse(
#ifndef SQLITE_OMIT_AUTHORIZATION #ifndef SQLITE_OMIT_AUTHORIZATION
/* Creating a virtual table invokes the authorization callback twice. /* Creating a virtual table invokes the authorization callback twice.
** The first invocation, to obtain permission to INSERT a row into the ** The first invocation, to obtain permission to INSERT a row into the
** sqlite_master table, has already been made by sqlite3StartTable(). ** sqlite_schema table, has already been made by sqlite3StartTable().
** The second call, to obtain permission to create the table, is made now. ** The second call, to obtain permission to create the table, is made now.
*/ */
if( pTable->azModuleArg ){ if( pTable->azModuleArg ){
@@ -446,9 +446,9 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
/* If the CREATE VIRTUAL TABLE statement is being entered for the /* If the CREATE VIRTUAL TABLE statement is being entered for the
** first time (in other words if the virtual table is actually being ** first time (in other words if the virtual table is actually being
** created now instead of just being read out of sqlite_master) then ** created now instead of just being read out of sqlite_schema) then
** do additional initialization work and store the statement text ** do additional initialization work and store the statement text
** in the sqlite_master table. ** in the sqlite_schema table.
*/ */
if( !db->init.busy ){ if( !db->init.busy ){
char *zStmt; char *zStmt;
@@ -470,7 +470,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
** the information we've collected. ** the information we've collected.
** **
** The VM register number pParse->regRowid holds the rowid of an ** The VM register number pParse->regRowid holds the rowid of an
** entry in the sqlite_master table tht was created for this vtab ** entry in the sqlite_schema table tht was created for this vtab
** by sqlite3StartTable(). ** by sqlite3StartTable().
*/ */
iDb = sqlite3SchemaToIndex(db, pTab->pSchema); iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
@@ -497,7 +497,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg); sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
} }
/* If we are rereading the sqlite_master table create the in-memory /* If we are rereading the sqlite_schema table create the in-memory
** record of the table. The xConnect() method is not called until ** record of the table. The xConnect() method is not called until
** the first time the virtual table is used in an SQL statement. This ** the first time the virtual table is used in an SQL statement. This
** allows a schema that contains virtual tables to be loaded before ** allows a schema that contains virtual tables to be loaded before

View File

@@ -38,7 +38,7 @@ proc mutex_counters {varname} {
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Tests mutex1-1.* test that sqlite3_config() returns SQLITE_MISUSE if # Tests mutex1-1.* test that sqlite3_config() returns SQLITE_MISUSE if
# is called at the wrong time. And that the first time sqlite3_initialize # is called at the wrong time. And that the first time sqlite3_initialize
# is called it obtains the 'static_master' mutex 3 times and a recursive # is called it obtains the 'static_main' mutex 3 times and a recursive
# mutex (sqlite3Config.pInitMutex) twice. Subsequent calls are no-ops # mutex (sqlite3Config.pInitMutex) twice. Subsequent calls are no-ops
# that do not require any mutexes. # that do not require any mutexes.
# #
@@ -75,7 +75,7 @@ do_test mutex1-1.6 {
do_test mutex1-1.7 { do_test mutex1-1.7 {
mutex_counters counters mutex_counters counters
# list $counters(total) $counters(static_master) # list $counters(total) $counters(static_main)
expr {$counters(total)>0} expr {$counters(total)>0}
} {1} } {1}
@@ -86,7 +86,7 @@ do_test mutex1-1.8 {
do_test mutex1-1.9 { do_test mutex1-1.9 {
mutex_counters counters mutex_counters counters
list $counters(total) $counters(static_master) list $counters(total) $counters(static_main)
} {0 0} } {0 0}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@@ -103,13 +103,13 @@ ifcapable threadsafe1&&shared_cache {
singlethread {} singlethread {}
multithread { multithread {
fast static_app1 static_app2 static_app3 fast static_app1 static_app2 static_app3
static_lru static_master static_mem static_open static_lru static_main static_mem static_open
static_prng static_pmem static_vfs1 static_vfs2 static_prng static_pmem static_vfs1 static_vfs2
static_vfs3 static_vfs3
} }
serialized { serialized {
fast recursive static_app1 static_app2 fast recursive static_app1 static_app2
static_app3 static_lru static_master static_mem static_app3 static_lru static_main static_mem
static_open static_prng static_pmem static_vfs1 static_open static_prng static_pmem static_vfs1
static_vfs2 static_vfs3 static_vfs2 static_vfs3
} }

View File

@@ -59,7 +59,7 @@ if {[wal_is_capable]} {
PRAGMA journal_mode = delete; PRAGMA journal_mode = delete;
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat; FROM stat;
} {wal delete sqlite_master / 1 leaf 0 0 916 0} } {wal delete sqlite_schema / 1 leaf 0 0 916 0}
} }
do_test stat-1.0 { do_test stat-1.0 {
@@ -85,9 +85,9 @@ do_test stat-1.2 {
do_test stat-1.3 { do_test stat-1.3 {
execsql { execsql {
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name = 'sqlite_master'; FROM stat WHERE name = 'sqlite_schema';
} }
} {sqlite_master / 1 leaf 2 77 831 40} } {sqlite_schema / 1 leaf 2 77 831 40}
do_test stat-1.4 { do_test stat-1.4 {
execsql { execsql {
DROP TABLE t1; DROP TABLE t1;
@@ -108,7 +108,7 @@ do_execsql_test stat-2.1 {
INSERT INTO t3 SELECT a_string(110+rowid), a_string(221+rowid) FROM t3 INSERT INTO t3 SELECT a_string(110+rowid), a_string(221+rowid) FROM t3
ORDER BY rowid; ORDER BY rowid;
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name != 'sqlite_master' ORDER BY name; FROM stat WHERE name != 'sqlite_schema' ORDER BY name;
} [list \ } [list \
sqlite_autoindex_t3_1 / 3 internal 3 368 623 125 \ sqlite_autoindex_t3_1 / 3 internal 3 368 623 125 \
sqlite_autoindex_t3_1 /000/ 8 leaf 8 946 46 123 \ sqlite_autoindex_t3_1 /000/ 8 leaf 8 946 46 123 \
@@ -138,7 +138,7 @@ do_execsql_test stat-2.1agg {
SELECT * FROM dbstat WHERE aggregate=TRUE ORDER BY name; SELECT * FROM dbstat WHERE aggregate=TRUE ORDER BY name;
} [list \ } [list \
sqlite_autoindex_t3_1 {} 5 {} 32 3898 1065 132 {} 5120 \ sqlite_autoindex_t3_1 {} 5 {} 32 3898 1065 132 {} 5120 \
sqlite_master {} 1 {} 2 84 824 49 {} 1024 \ sqlite_schema {} 1 {} 2 84 824 49 {} 1024 \
t3 {} 17 {} 47 11188 5815 370 {} 17408 \ t3 {} 17 {} 47 11188 5815 370 {} 17408 \
] ]
@@ -158,7 +158,7 @@ do_execsql_test stat-3.1 {
CREATE INDEX i4 ON t4(x); CREATE INDEX i4 ON t4(x);
INSERT INTO t4(rowid, x) VALUES(2, a_string(7777)); INSERT INTO t4(rowid, x) VALUES(2, a_string(7777));
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
FROM stat WHERE name != 'sqlite_master' ORDER BY name; FROM stat WHERE name != 'sqlite_schema' ORDER BY name;
} [list \ } [list \
i4 / 3 leaf 1 103 905 7782 \ i4 / 3 leaf 1 103 905 7782 \
i4 /000+000000 4 overflow 0 1020 0 0 \ i4 /000+000000 4 overflow 0 1020 0 0 \
@@ -183,7 +183,7 @@ do_execsql_test stat-3.2 {
SELECT *, '|' FROM dbstat WHERE aggregate=TRUE ORDER BY name; SELECT *, '|' FROM dbstat WHERE aggregate=TRUE ORDER BY name;
} [list \ } [list \
i4 {} 9 {} 1 7782 1386 7782 {} 9216 | \ i4 {} 9 {} 1 7782 1386 7782 {} 9216 | \
sqlite_master {} 1 {} 2 74 834 40 {} 1024 | \ sqlite_schema {} 1 {} 2 74 834 40 {} 1024 | \
t4 {} 8 {} 1 7780 367 7780 {} 8192 | \ t4 {} 8 {} 1 7780 367 7780 {} 8192 | \
] ]
@@ -221,11 +221,11 @@ do_execsql_test stat-5.1 {
do_execsql_test stat-5.20 { do_execsql_test stat-5.20 {
SELECT name, quote(path), pageno, quote(pagetype), ncell, payload, SELECT name, quote(path), pageno, quote(pagetype), ncell, payload,
unused, mx_payload, '|' FROM dbstat('main',1); unused, mx_payload, '|' FROM dbstat('main',1);
} {sqlite_master NULL 1 NULL 1 34 878 34 | tx NULL 1 NULL 0 0 1016 0 |} } {sqlite_schema NULL 1 NULL 1 34 878 34 | tx NULL 1 NULL 0 0 1016 0 |}
do_execsql_test stat-5.21 { do_execsql_test stat-5.21 {
SELECT name, quote(path), pageno, quote(pagetype), ncell, payload, SELECT name, quote(path), pageno, quote(pagetype), ncell, payload,
unused, mx_payload, '|' FROM dbstat('aux1',1); unused, mx_payload, '|' FROM dbstat('aux1',1);
} {sqlite_master NULL 1 NULL 1 34 878 34 | t1 NULL 3 NULL 2 3033 5 1517 |} } {sqlite_schema NULL 1 NULL 1 34 878 34 | t1 NULL 3 NULL 2 3033 5 1517 |}
do_catchsql_test stat-6.1 { do_catchsql_test stat-6.1 {
@@ -247,27 +247,27 @@ do_execsql_test 7.1 {
do_execsql_test 7.1.1 { do_execsql_test 7.1.1 {
SELECT * FROM dbstat('123'); SELECT * FROM dbstat('123');
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
do_execsql_test 7.1.2 { do_execsql_test 7.1.2 {
SELECT * FROM dbstat(123); SELECT * FROM dbstat(123);
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
do_execsql_test 7.1.3 { do_execsql_test 7.1.3 {
CREATE VIRTUAL TABLE x2 USING dbstat('123'); CREATE VIRTUAL TABLE x2 USING dbstat('123');
SELECT * FROM x2; SELECT * FROM x2;
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
do_execsql_test 7.1.4 { do_execsql_test 7.1.4 {
CREATE VIRTUAL TABLE x3 USING dbstat(123); CREATE VIRTUAL TABLE x3 USING dbstat(123);
SELECT * FROM x3; SELECT * FROM x3;
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
@@ -280,7 +280,7 @@ do_execsql_test 7.2 {
do_execsql_test 7.2.1 { do_execsql_test 7.2.1 {
SELECT * FROM dbstat('123corp'); SELECT * FROM dbstat('123corp');
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
do_catchsql_test 7.2.2 { do_catchsql_test 7.2.2 {
@@ -290,7 +290,7 @@ do_execsql_test 7.2.3 {
CREATE VIRTUAL TABLE x2 USING dbstat('123corp'); CREATE VIRTUAL TABLE x2 USING dbstat('123corp');
SELECT * FROM x2; SELECT * FROM x2;
} { } {
sqlite_master / 1 leaf 1 37 875 37 0 1024 sqlite_schema / 1 leaf 1 37 875 37 0 1024
x1 / 2 leaf 1 4 1008 4 1024 1024 x1 / 2 leaf 1 4 1008 4 1024 1024
} }
do_catchsql_test 7.2.4 { do_catchsql_test 7.2.4 {

View File

@@ -16,7 +16,7 @@ proc is_without_rowid {tname} {
db eval "PRAGMA index_list = '$t'" o { db eval "PRAGMA index_list = '$t'" o {
if {$o(origin) == "pk"} { if {$o(origin) == "pk"} {
set n $o(name) set n $o(name)
if {0==[db one { SELECT count(*) FROM sqlite_master WHERE name=$n }]} { if {0==[db one { SELECT count(*) FROM sqlite_schema WHERE name=$n }]} {
return 1 return 1
} }
} }
@@ -160,7 +160,7 @@ if {![db exists {SELECT 1 FROM pragma_compile_options
exit 1 exit 1
} }
db eval {SELECT count(*) FROM sqlite_master} db eval {SELECT count(*) FROM sqlite_schema}
set pageSize [expr {wide([db one {PRAGMA page_size}])}] set pageSize [expr {wide([db one {PRAGMA page_size}])}]
if {$flags(-pageinfo)} { if {$flags(-pageinfo)} {
@@ -245,8 +245,8 @@ db eval {DROP TABLE temp.stat}
set isCompressed 0 set isCompressed 0
set compressOverhead 0 set compressOverhead 0
set depth 0 set depth 0
set sql { SELECT name, tbl_name FROM sqlite_master WHERE rootpage>0 } set sql { SELECT name, tbl_name FROM sqlite_schema WHERE rootpage>0 }
foreach {name tblname} [concat sqlite_master sqlite_master [db eval $sql]] { foreach {name tblname} [concat sqlite_schema sqlite_schema [db eval $sql]] {
set is_index [expr {$name!=$tblname}] set is_index [expr {$name!=$tblname}]
set is_without_rowid [is_without_rowid $name] set is_without_rowid [is_without_rowid $name]
@@ -560,7 +560,7 @@ proc autovacuum_overhead {filePages pageSize} {
# nautoindex: Number of indices created automatically. # nautoindex: Number of indices created automatically.
# nmanindex: Number of indices created manually. # nmanindex: Number of indices created manually.
# user_payload: Number of bytes of payload in table btrees # user_payload: Number of bytes of payload in table btrees
# (not including sqlite_master) # (not including sqlite_schema)
# user_percent: $user_payload as a percentage of total file size. # user_percent: $user_payload as a percentage of total file size.
### The following, setting $file_bytes based on the actual size of the file ### The following, setting $file_bytes based on the actual size of the file
@@ -590,15 +590,15 @@ set file_pgcnt2 [expr {$inuse_pgcnt+$free_pgcnt2+$av_pgcnt}]
# Account for the lockbyte page # Account for the lockbyte page
if {$file_pgcnt2*$pageSize>1073742335} {incr file_pgcnt2} if {$file_pgcnt2*$pageSize>1073742335} {incr file_pgcnt2}
set ntable [db eval {SELECT count(*)+1 FROM sqlite_master WHERE type='table'}] set ntable [db eval {SELECT count(*)+1 FROM sqlite_schema WHERE type='table'}]
set nindex [db eval {SELECT count(*) FROM sqlite_master WHERE type='index'}] set nindex [db eval {SELECT count(*) FROM sqlite_schema WHERE type='index'}]
set sql {SELECT count(*) FROM sqlite_master WHERE name LIKE 'sqlite_autoindex%'} set sql {SELECT count(*) FROM sqlite_schema WHERE name LIKE 'sqlite_autoindex%'}
set nautoindex [db eval $sql] set nautoindex [db eval $sql]
set nmanindex [expr {$nindex-$nautoindex}] set nmanindex [expr {$nindex-$nautoindex}]
# set total_payload [mem eval "SELECT sum(payload) FROM space_used"] # set total_payload [mem eval "SELECT sum(payload) FROM space_used"]
set user_payload [mem one {SELECT int(sum(payload)) FROM space_used set user_payload [mem one {SELECT int(sum(payload)) FROM space_used
WHERE NOT is_index AND name NOT LIKE 'sqlite_master'}] WHERE NOT is_index AND name NOT LIKE 'sqlite_schema'}]
set user_percent [percent $user_payload $file_bytes] set user_percent [percent $user_payload $file_bytes]
# Output the summary statistics calculated above. # Output the summary statistics calculated above.