-C Fix\sa\stypo\sin\sshared_schema.md.
-D 2019-02-14T17:59:36.324
+C Change\sthe\sname\sof\sthe\sSQLITE_OPEN_REUSE_SCHEMA\sflag\sto\sSQLITE_OPEN_SHARED_SCHEMA.
+D 2019-02-14T18:38:44.649
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 56456706c4da271309914c756c9c8ea537685f1c79f8785afa72f968d6810482
F src/btree.c 161b6a57b91d160065e512a4d0be180e402a16a059034a380cbdc2411924f8ac
F src/btree.h 63b94fb38ce571c15eb6a3661815561b501d23d5948b2d1e951fbd7a2d04e8d3
F src/btreeInt.h 6111c15868b90669f79081039d19e7ea8674013f907710baa3c814dc3f8bfd3f
-F src/build.c c6b40555c68a157d85b4fbd0e08842ce87a374aad685341b7b6fa05d87770ffb
-F src/callback.c f928820315b31d2aca6f156a1d4aa61d2ccb62b98095839f3c95a352e5cbd1d7
+F src/build.c 66830361a2d820e52c483bd5ac3af0fd111795fc7836d99cfdc8818dbfa23d5d
+F src/callback.c 8d0402ae92ba24b99b4af9abf6881821e78826a9cfe984b38dfbf7664804fea2
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 109e58d00f62e8e71ee1eb5944ac18b90171c928ab2e082e058056e1137cc20b
F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957
F src/pcache1.c a72804486dfa8e4b6bc30d666c97ecf1155f91a4351fc6e48ea4097e4eb304fb
F src/pragma.c af67dedaad8bafe9a5f9adcec32a0da6dd118617dd8220ad1d118f5a6bf83a02
F src/pragma.h a776bb9c915207e9d1117b5754743ddf1bf6a39cc092a4a44e74e6cb5fab1177
-F src/prepare.c c8bd9570e92b879023d5750412f81ac6613f3754c2462ee26fce9945d1fbc3a9
+F src/prepare.c b7ef5c87a9a8f28999f1085c25c298558a936e561ffdccec1d629d1497a5616d
F src/printf.c cbf27c320091a83279d1738f68a27a9fe01698c607ce80516ab6bdb5a9c36a1a
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 1588690ee4cc39b4b9ea3230d4e3543d5ec3b5e898c87521f1375af0f1934cd4
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c c998f694759e37799929e28df8a2649747f8774d4fc233529ab6bda689388e15
-F src/shell.c.in e32838e30357f2d4913a76345aa9407bd6662d48121ebe44528a9fb4feaee6d6
-F src/sqlite.h.in 528af7447d87ca678409b3280faa3905bab5fab265590821b0df0c8bc956e3a2
+F src/shell.c.in d7d63fd1ecef44d19088adc188652252327eab782d59cf1958657943132b5082
+F src/sqlite.h.in cd9b7c397b942a4903c46ebbabee47f920a9916e96e70e0b4f793076d4b45e31
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
-F src/sqliteInt.h 6173e47d1cddb8c9aa5ccfaa0f40b9f62635050d503245e6439b3cd96fb6a53d
+F src/sqliteInt.h 176ae22317dda2b49d9c3c28bf9215e7ae8f012f88c37dd505f6be8b3637db28
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
-F src/tclsqlite.c b17e7c1629311de001887ad5afa4ed9bfddd85be0bbb7e6fdf16352162c98081
+F src/tclsqlite.c f11d822fb2bd6e155d41535a629d1c34daf3d98a37b1f0ea6b4cb11d150d3c57
F src/test1.c 353b066e7ec761c4c715c1c20b888e0e7a0b0c0eda7f68c110e032d63713cade
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F test/releasetest.tcl 7712811e0f4e2f198ec786cb2e1352b3793d7395f48a3cceef0572d8823eb75e x
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
-F test/reuse1.test f676744eaf744be8b9bd3e781f0eb3ab1c8010b56ebe31291584b24a6d4c50b1
-F test/reuse2.test d9fd3a796db599bbe76554f0f0f635874c7de198205fcd36c4b8261c7b0786a2
-F test/reuse3.test c9cc919586a6005d7ed19cf5ab8eb8c618f35dab5ed5ef8526f37815888c4973
+F test/reuse1.test 31c312375ccfcc5c2abc1fca5e4a89d6309c57ea6b1fa3179a5eee68016f9c74
+F test/reuse2.test 51a4ba225c602bf19847c27c5f0156c3f273f2c8de2456c22b97c2a9a3824d87
+F test/reuse3.test 3e865c031fe71242ebcdd90baf34cba8be4dddacad2fe025e697ecf035335f4a
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
F test/rollback2.test bc868d57899dc6972e2b4483faae0e03365a0556941474eec487ae21d8d38bb6
F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a5f8067dde1e8974f779ab838a02416a7dd9d20d253af860d08d635cfede6fee
-R 952f290d6bface17a7cafe346ea48f9d
+P e47a5aea76560e86e5417fea9e2219ec6c30e47ef383e499cfe927f64d584dac
+R 8625b684c268ad69e5f2e6997ec316b6
U dan
-Z a99cb125e58b7df930a104ad1379ef4e
+Z 501ceb9c380b311fe8ede824c64ca859
-e47a5aea76560e86e5417fea9e2219ec6c30e47ef383e499cfe927f64d584dac
\ No newline at end of file
+7257fcc8c990b46a4f6a9e506f4a4a40195e6b2c626efd380cfa01f0ce8eb0fb
\ No newline at end of file
}
#endif
-static int loadReusableSchema(sqlite3 *db, int iDb){
+/*
+** If this database connection was opened with the SQLITE_OPEN_SHARED_SCHEMA
+** flag specified, then ensure that the database schema for database iDb
+** is loaded. Either by obtaining a Schema object from the schema-pool, or
+** by reading the contents of the sqlite_master table.
+**
+** If the database handle was not opened with SQLITE_OPEN_SHARED_SCHEMA, or
+** if the schema for database iDb is already loaded, this function is a no-op.
+**
+** Non-zero is returned if a schema is loaded, or zero if it was already
+** loaded when this function was called..
+*/
+static int loadSharableSchema(sqlite3 *db, int iDb){
if( IsReuseSchema(db)
&& DbHasProperty(db, iDb, DB_SchemaLoaded)==0
&& (db->init.busy==0 || (iDb!=1 && db->init.iDb==1))
if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){
int bUnload;
assert( sqlite3SchemaMutexHeld(db, j, 0) );
- bUnload = loadReusableSchema(db, j);
+ bUnload = loadSharableSchema(db, j);
p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
if( p ) return p;
if( bUnload ){
pMod = sqlite3PragmaVtabRegister(db, zName);
}
if( pMod ){
- loadReusableSchema(db, 0);
+ loadSharableSchema(db, 0);
if( sqlite3VtabEponymousTableInit(pParse, pMod) ){
return pMod->pEpoTab;
}
#include "sqliteInt.h"
/*
-** Connections opened with the SQLITE_OPEN_REUSE_SCHEMA flag specified
+** Connections opened with the SQLITE_OPEN_SHARED_SCHEMA flag specified
** may use SchemaPool objects for any database that is not the temp db
** (iDb==1). For such databases (type "struct Db") there are three states
** the Schema/SchemaPool object may be in.
}
/*
-** If this database was opened with the SQLITE_OPEN_REUSE_SCHEMA flag
+** If this database was opened with the SQLITE_OPEN_SHARED_SCHEMA flag
** and iDb!=1, then disconnect from the schema-pool associated with
** database iDb. Otherwise, clear the Schema object belonging to
** database iDb.
/*
** Check that the schema of db iDb is writable (either because it is the
** temp db schema or because the db handle was opened without
-** SQLITE_OPEN_REUSE_SCHEMA). If so, do nothing. Otherwise, leave an
+** SQLITE_OPEN_SHARED_SCHEMA). If so, do nothing. Otherwise, leave an
** error in the Parse object.
*/
void sqlite3SchemaWritable(Parse *pParse, int iDb){
- if( iDb!=1 && (pParse->db->openFlags & SQLITE_OPEN_REUSE_SCHEMA)
+ if( iDb!=1 && (pParse->db->openFlags & SQLITE_OPEN_SHARED_SCHEMA)
&& IN_DECLARE_VTAB==0
){
sqlite3ErrorMsg(pParse, "attempt to modify read-only schema");
/*
** The schema for database iDb of database handle db, which was opened
-** with SQLITE_OPEN_REUSE_SCHEMA, has just been parsed. This function either
+** with SQLITE_OPEN_SHARED_SCHEMA, has just been parsed. This function either
** finds a matching SchemaPool object on the global list (schemaPoolList) or
** else allocates a new one and sets the Db.pSPool variable accordingly.
**
/*
** If parameter iDb is 1 (the temp db), or if connection handle db was not
-** opened with the SQLITE_OPEN_REUSE_SCHEMA flag, this function is a no-op.
+** opened with the SQLITE_OPEN_SHARED_SCHEMA flag, this function is a no-op.
** Otherwise, it disconnects from the schema-pool associated with database
** iDb, assuming it is connected.
**
/*
** In most cases, this function finds and returns the schema associated
** with BTree handle pBt, creating a new one if necessary. However, if
-** the database handle was opened with the SQLITE_OPEN_REUSE_SCHEMA flag
+** the database handle was opened with the SQLITE_OPEN_SHARED_SCHEMA flag
** specified, a new, empty, Schema object in memory obtained by
** sqlite3_malloc() is always returned.
*/
Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
Schema *p;
- if( pBt && (db->openFlags & SQLITE_OPEN_REUSE_SCHEMA)==0 ){
+ if( pBt && (db->openFlags & SQLITE_OPEN_SHARED_SCHEMA)==0 ){
p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear);
}else{
p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));
}
}
- if( iDb!=1 && (db->openFlags & SQLITE_OPEN_REUSE_SCHEMA) ){
+ if( iDb!=1 && (db->openFlags & SQLITE_OPEN_SHARED_SCHEMA) ){
schemaUpdateChecksum(pData, argv[0], argv[1], argv[2]);
}
return 0;
rc = SQLITE_OK;
}
- if( rc==SQLITE_OK && iDb!=1 && (db->openFlags & SQLITE_OPEN_REUSE_SCHEMA) ){
+ if( rc==SQLITE_OK && iDb!=1 && (db->openFlags & SQLITE_OPEN_SHARED_SCHEMA) ){
rc = sqlite3SchemaConnect(db, iDb, initData.cksum);
}
}
case SHELL_OPEN_REUSESCHEMA: {
sqlite3_open_v2(p->zDbFilename, &p->db,
- SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_REUSE_SCHEMA, 0);
+ SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_SHARED_SCHEMA,0);
break;
}
case SHELL_OPEN_UNSPEC:
#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
/* Reserved: 0x00F00000 */
-#define SQLITE_OPEN_REUSE_SCHEMA 0x01000000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_SHARED_SCHEMA 0x01000000 /* Ok for sqlite3_open_v2() */
/*
#endif
};
-#define IsReuseSchema(db) (((db)->openFlags & SQLITE_OPEN_REUSE_SCHEMA)!=0)
+#define IsReuseSchema(db) (((db)->openFlags & SQLITE_OPEN_SHARED_SCHEMA)!=0)
/*
** A macro to discover the encoding of a database.
Tcl_WrongNumArgs(interp, 1, objv,
"HANDLE ?FILENAME? ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN?"
" ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri BOOLEAN?"
- " ?-reuse-schema BOOLEAN?"
+ " ?-shared-schema BOOLEAN?"
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_CODEC_FROM_TCL)
" ?-key CODECKEY?"
#endif
}else{
flags &= ~SQLITE_OPEN_URI;
}
- }else if( strcmp(zArg, "-reuse-schema")==0 ){
+ }else if( strcmp(zArg, "-shared-schema")==0 ){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i], &b) ) return TCL_ERROR;
if( b ){
- flags |= SQLITE_OPEN_REUSE_SCHEMA;
+ flags |= SQLITE_OPEN_SHARED_SCHEMA;
}else{
- flags &= ~SQLITE_OPEN_REUSE_SCHEMA;
+ flags &= ~SQLITE_OPEN_SHARED_SCHEMA;
}
}else{
Tcl_AppendResult(interp, "unknown option: ", zArg, (char*)0);
do_test 1.2 {
db close
db2 close
- sqlite3 db2 test.db2 -reuse-schema 1
- sqlite3 db test.db -reuse-schema 1
+ sqlite3 db2 test.db2 -shared-schema 1
+ sqlite3 db test.db -shared-schema 1
} {}
do_execsql_test -db db2 1.3.1 {
}
db close
- sqlite3 db test.db -reuse-schema 1
+ sqlite3 db test.db -shared-schema 1
do_execsql_test 2.1 {
ATTACH 'test.db2' AS aux;
} {4 5 6}
db close
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
do_execsql_test 3.4 { ATTACH 'test.db2' AS aux } {}
do_execsql_test 3.5 { SELECT * FROM main.v1 } {1 2 3}
forcecopy test.db test.db2
db close
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
execsql {
ATTACH 'test.db2' AS aux;
PRAGMA recursive_triggers = 1;
}
db close
forcecopy test.db test.db2
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
execsql { ATTACH 'test.db2' AS aux }
foreach {tn sql} {
INSERT INTO t1 VALUES(1, 2, 3), (4, 5, 6);
}
db close
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
foreach {tn sql} {
1 { ANALYZE }
2 { ANALYZE t1 }
}
db close
forcecopy test.db test.db2
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
execsql { ATTACH 'test.db2' AS aux }
do_execsql_test 6.1 {
db close
forcecopy test.db test.db2
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
execsql { ATTACH 'test.db2' AS aux }
do_execsql_test 7.1 {
do_test 1.2 {
catch { db close }
catch { db2 close }
- sqlite3 db2 test.db -reuse-schema 1
- sqlite3 db test.db -reuse-schema 1
+ sqlite3 db2 test.db -shared-schema 1
+ sqlite3 db test.db -shared-schema 1
} {}
do_execsql_test -db db2 1.3.1 {
INSERT INTO ft VALUES('one two three');
}
db close
- sqlite3 db test.db -reuse-schema 1
+ sqlite3 db test.db -shared-schema 1
do_execsql_test 2.1 {
SELECT * FROM ft
} {2}
do_test 3.1 {
- sqlite3 db1 test.db -reuse-schema 1
- sqlite3 db2 test.db -reuse-schema 1
+ sqlite3 db1 test.db -shared-schema 1
+ sqlite3 db2 test.db -shared-schema 1
} {}
do_execsql_test -db db1 3.2.1 { SELECT * FROM t1 }
SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
} {nref=2 nschema=1}
-sqlite3 db3 test.db -reuse-schema 1
+sqlite3 db3 test.db -shared-schema 1
register_schemapool_module db3
do_execsql_test 3.5 {
forcecopy test.db test.db${i}
}
sqlite3 db test.db
- sqlite3 db2 test.db -reuse-schema 1
+ sqlite3 db2 test.db -shared-schema 1
} {}
register_schemapool_module db
}
db close
do_test 5.0.2 {
- sqlite3 db2 test.db -reuse-schema 1
+ sqlite3 db2 test.db -shared-schema 1
register_schemapool_module db2
for {set i 1} {$i<6} {incr i} {
forcedelete test.db${i}-journal test.db${i}-wal test.db${i}-wal2
} {}
db close
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
do_execsql_test 1.1 {
CREATE TEMP VIEW v1 AS SELECT * FROM t1;
}
db close
-sqlite3 db test.db -reuse-schema 1
+sqlite3 db test.db -shared-schema 1
do_catchsql_test 2.1 {
SELECT * FROM x1;
} {1 {no such table: x1}}