Added SQLITE_OPEN_SHAREDCACHE and SQLITE_OPEN_PRIVATECACHE flags as

possibilities to sqlite3_open_v2(), to override the global shared
cache mode setting.  Ticket [9fd0bc36639c15]

FossilOrigin-Name: f509eb8b488bb39deda4ca88f66ed40c6784af02
This commit is contained in:
drh 2009-09-09 14:17:52 +00:00
parent 643a392270
commit f1f12688d8
6 changed files with 35 additions and 17 deletions

View File

@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Increase\sthe\ssize\sof\sbitvec\sobjects\sto\s1024\sbytes\son\s64-bit\ssystems.
D 2009-09-09T12:41:18
C Added\sSQLITE_OPEN_SHAREDCACHE\sand\sSQLITE_OPEN_PRIVATECACHE\sflags\sas\npossibilities\sto\ssqlite3_open_v2(),\sto\soverride\sthe\sglobal\sshared\ncache\smode\ssetting.\s\sTicket\s[9fd0bc36639c15]
D 2009-09-09T14:17:53
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 73ddeec9dd10b85876c5c2ce1fdce627e1dcc7f8
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -109,7 +109,7 @@ F src/auth.c d6a88bf8e81e6a079ccb8881002b327e42ec46b9
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c ed215b95734045e58358c3b3e16448f8fe6a235a
F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7
F src/btree.c 873a82706e07604a638e02e12617983df8e8070a
F src/btree.c 9c425425784c5d569bc0309c22251698ba906451
F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c 5269733241f459705189aa39f4eacf18b10d7661
@ -129,7 +129,7 @@ F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
F src/legacy.c 303b4ffcf1ae652fcf5ef635846c563c254564f6
F src/lempar.c 0c4d1ab0a5ef2b0381eb81a732c54f68f27a574d
F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a
F src/main.c e33c4d17cc0a398847f5c9926ccdfe7e66605b87
F src/main.c 482a5a4a6f22d04c03deefeeae5c49c2f06a5d15
F src/malloc.c b1725183bcc4ce2e569f1b65da844dc3e4c7a643
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
@ -144,7 +144,7 @@ F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0
F src/mutex_unix.c aff26c77f698b552becfedfa677ad1036c42d790
F src/mutex_w32.c b2c1481ee93b0ac7a8fa5346570fd173b6763fdb
F src/notify.c 0127121816d8a861deb0dfd111b495346bf233db
F src/os.c 9fea283e336ee31caa4654d6cb05a129a1c42d2f
F src/os.c 8d62d8d98ad7909cb0dd294c1e5f3835c887ccb6
F src/os.h 00a1334a4eecee7f7bef79ac606b88d325119f21
F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
@ -164,7 +164,7 @@ F src/resolve.c 941843301f6fda6c6350839c6955a172441a0782
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
F src/select.c a7a075456d4e640ffd7d0a33202d306c69c88f72
F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb
F src/sqlite.h.in e5949b46f9a05aadde22848f92fae5c9ba87ee0e
F src/sqlite.h.in 5af8181f815831a8672c3834c60e6b4418448bcc
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 66914c7a4a8ad427dc3705e13df95763003ea8fb
F src/sqliteLimit.h be44f7f46c14bb4c21870074b1e6f1ac0abd6701
@ -753,14 +753,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 135d656a20a2a450955ed9ec57d9637cf31493c6
R f91172640a09b757977e441541b57ec0
P f1272b90f6078d301ab05592593e9415f2b2b90b
R 30f716aefa81fdbf0f2b201c3325eab7
U drh
Z 997645a8d3a88141379209cea73b2e0e
Z 679e313c9aeecd41d844d799997842b6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFKp6JxoxKgR168RlERAljzAJ9qUdcCxBF0PoRplZd+1q307qwxOQCgi1x0
dP4jOO6AZZUJzlZM1fHDEUs=
=rmmB
iD8DBQFKp7kUoxKgR168RlERAqDGAKCNO6g4tKDZlhNsaEYURMls5+SB5gCgiROs
0eW6S21fZd96/lHFcfmX7eE=
=ebjX
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
f1272b90f6078d301ab05592593e9415f2b2b90b
f509eb8b488bb39deda4ca88f66ed40c6784af02

View File

@ -1694,7 +1694,7 @@ int sqlite3BtreeOpen(
** existing BtShared object that we can share with
*/
if( isMemdb==0 && zFilename && zFilename[0] ){
if( sqlite3GlobalConfig.sharedCacheEnabled ){
if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){
int nFullPathname = pVfs->mxPathname+1;
char *zFullPathname = sqlite3Malloc(nFullPathname);
sqlite3_mutex *mutexShared;

View File

@ -1544,6 +1544,11 @@ static int openDatabase(
}else{
isThreadsafe = sqlite3GlobalConfig.bFullMutex;
}
if( flags & SQLITE_OPEN_PRIVATECACHE ){
flags &= SQLITE_OPEN_SHAREDCACHE;
}else if( sqlite3GlobalConfig.sharedCacheEnabled ){
flags |= SQLITE_OPEN_SHAREDCACHE;
}
/* Remove harmful bits from the flags parameter
**

View File

@ -114,7 +114,11 @@ int sqlite3OsOpen(
){
int rc;
DO_OS_MALLOC_TEST(0);
rc = pVfs->xOpen(pVfs, zPath, pFile, flags, pFlagsOut);
/* 0x7f1f is a mask of SQLITE_OPEN_ flags that are valid to be passed
** down into the VFS layer. Some SQLITE_OPEN_ flags (for example,
** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
** reaching the VFS. */
rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x7f1f, pFlagsOut);
assert( rc==SQLITE_OK || pFile->pMethods==0 );
return rc;
}

View File

@ -434,6 +434,8 @@ int sqlite3_exec(
#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
/*
** CAPI3REF: Device Characteristics {H10240} <H11120>
@ -2095,7 +2097,8 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** except that it accepts two additional parameters for additional control
** over the new database connection. The flags parameter can take one of
** the following three values, optionally combined with the
** [SQLITE_OPEN_NOMUTEX] or [SQLITE_OPEN_FULLMUTEX] flags:
** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],
** and/or [SQLITE_OPEN_PRIVATECACHE] flags:
**
** <dl>
** <dt>[SQLITE_OPEN_READONLY]</dt>
@ -2115,7 +2118,8 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
**
** If the 3rd parameter to sqlite3_open_v2() is not one of the
** combinations shown above or one of the combinations shown above combined
** with the [SQLITE_OPEN_NOMUTEX] or [SQLITE_OPEN_FULLMUTEX] flags,
** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX],
** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_SHAREDCACHE] flags,
** then the behavior is undefined.
**
** If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
@ -2124,6 +2128,11 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
** in the serialized [threading mode] unless single-thread was
** previously selected at compile-time or start-time.
** The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
** eligible to use [shared cache mode], regardless of whether or not shared
** cache is enabled using [sqlite3_enable_shared_cache()]. The
** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
** participate in [shared cache mode] even if it is enabled.
**
** If the filename is ":memory:", then a private, temporary in-memory database
** is created for the connection. This in-memory database will vanish when