Add the mode=memory option to URI filenames, which when present forces the
database to be an in-memory database. This enables named in-memory databases. FossilOrigin-Name: 651520fa84ee0c488bef660bab9865500309d5e9
This commit is contained in:
parent
a9cfaba95a
commit
9c67b2aae0
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Omit\sthe\sfts3\sunicode\scharacter\sclass\sroutines\sfrom\sthe\sbuild\sif\sfts3/4\nis\sdisabled.
|
||||
D 2012-05-28T12:22:00.527
|
||||
C Add\sthe\smode=memory\soption\sto\sURI\sfilenames,\swhich\swhen\spresent\sforces\sthe\ndatabase\sto\sbe\san\sin-memory\sdatabase.\s\sThis\senables\snamed\sin-memory\sdatabases.
|
||||
D 2012-05-28T13:58:00.304
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -123,7 +123,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||
F src/backup.c 6be23a344d3301ae38e92fddb3a33b91c309fce4
|
||||
F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
|
||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||
F src/btree.c 964c7862e1e27c543d2fff2e537ceadc4026c682
|
||||
F src/btree.c f0b71054103cb77eb5e782088c16998ec4f06624
|
||||
F src/btree.h 48a013f8964f12d944d90e4700df47b72dd6d923
|
||||
F src/btreeInt.h 38a639c0542c29fe8331a221c4aed0cb8686249e
|
||||
F src/build.c 2bb2163bb1e69f59e9f36a9413079ead42fa1d2c
|
||||
@ -145,7 +145,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
|
||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
|
||||
F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
|
||||
F src/main.c a2cfba189be2c653eb274c39fc12f169bbb9baa3
|
||||
F src/main.c fdd95737fe28db3ad2b740c8a134b40592c6b20a
|
||||
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1
|
||||
@ -180,7 +180,7 @@ F src/resolve.c b3c70ab28cac60de33684c9aa9e5138dcf71d6dd
|
||||
F src/rowset.c f6a49f3e9579428024662f6e2931832511f831a1
|
||||
F src/select.c f6c4833c4d8e94714761d99013d74f381e084f1d
|
||||
F src/shell.c c16f72e34f611f060546709564c121a67cb2b31b
|
||||
F src/sqlite.h.in 4f4d4792f6fb00387c877af013cb09d955643f12
|
||||
F src/sqlite.h.in be400745291421efa0de9a8bace329de6d3544e2
|
||||
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
||||
F src/sqliteInt.h 97ccae71ae0a4e924dcb9fab14eb4fc4839790da
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
@ -389,7 +389,7 @@ F test/e_resolve.test dcce9308fb13b934ce29591105d031d3e14fbba6
|
||||
F test/e_select.test f5d4b81205701deacfae42051ae200969c41d2c0
|
||||
F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92
|
||||
F test/e_update.test 161d5dc6a3ed9dd08f5264d13e20735d7a89f00c
|
||||
F test/e_uri.test e8b894474fdfe7b18b0c9cb2d911270de2ad64ce
|
||||
F test/e_uri.test cd2ddb4494c7ebf30b6e3539645bb4e54c0104b9
|
||||
F test/e_vacuum.test 331da289ae186656cf5f2eb27f577a89c0c221af
|
||||
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
|
||||
F test/enc2.test 796c59832e2b9a52842f382ffda8f3e989db03ad
|
||||
@ -689,7 +689,7 @@ F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
|
||||
F test/selectB.test 954e4e49cf1f896d61794e440669e03a27ceea25
|
||||
F test/selectC.test 871fb55d884d3de5943c4057ebd22c2459e71977
|
||||
F test/server1.test 46803bd3fe8b99b30dbc5ff38ffc756f5c13a118
|
||||
F test/shared.test 930104c2a6c173a8e21a850163c9e0475846a127
|
||||
F test/shared.test 64fe647f17b2de0622437829a9e9823c20439fce
|
||||
F test/shared2.test 03eb4a8d372e290107d34b6ce1809919a698e879
|
||||
F test/shared3.test ebf77f023f4bdaa8f74f65822b559e86ce5c6257
|
||||
F test/shared4.test 72d90821e8d2fc918a08f16d32880868d8ee8e9d
|
||||
@ -1004,7 +1004,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
P e72179f3a43e4df36b7c2955eaacce6c804272c6
|
||||
R c3df2d9f62e340f7317d2a936c704930
|
||||
P c00bb5d4601efc15933f222349e96a043b610a19
|
||||
R 9e44b5ae3872c9bc977aa50c770bf24a
|
||||
U drh
|
||||
Z bb072a5d158a0ecbca30cdcf64cbb02f
|
||||
Z 18aef601d2d3d45f555f16b789eead33
|
||||
|
@ -1 +1 @@
|
||||
c00bb5d4601efc15933f222349e96a043b610a19
|
||||
651520fa84ee0c488bef660bab9865500309d5e9
|
@ -1721,7 +1721,8 @@ int sqlite3BtreeOpen(
|
||||
const int isMemdb = 0;
|
||||
#else
|
||||
const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0)
|
||||
|| (isTempDb && sqlite3TempInMemory(db));
|
||||
|| (isTempDb && sqlite3TempInMemory(db))
|
||||
|| (vfsFlags & SQLITE_OPEN_MEMORY)!=0;
|
||||
#endif
|
||||
|
||||
assert( db!=0 );
|
||||
|
@ -2012,10 +2012,14 @@ int sqlite3ParseUri(
|
||||
{ "ro", SQLITE_OPEN_READONLY },
|
||||
{ "rw", SQLITE_OPEN_READWRITE },
|
||||
{ "rwc", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },
|
||||
{ "memory",
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
|
||||
| SQLITE_OPEN_MEMORY },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
mask = SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
|
||||
mask = SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE
|
||||
| SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY;
|
||||
aMode = aOpenMode;
|
||||
limit = mask & flags;
|
||||
zModeType = "access";
|
||||
@ -2036,7 +2040,7 @@ int sqlite3ParseUri(
|
||||
rc = SQLITE_ERROR;
|
||||
goto parse_uri_out;
|
||||
}
|
||||
if( mode>limit ){
|
||||
if( (mode & ~SQLITE_OPEN_MEMORY)>limit ){
|
||||
*pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s",
|
||||
zModeType, zVal);
|
||||
rc = SQLITE_PERM;
|
||||
|
@ -473,6 +473,7 @@ int sqlite3_exec(
|
||||
#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
|
||||
#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */
|
||||
#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */
|
||||
#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */
|
||||
#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
|
||||
#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
|
||||
#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
|
||||
|
@ -254,6 +254,8 @@ foreach {tn uri error} "
|
||||
4 {file:test.db?mode=Ro} {no such access mode: Ro}
|
||||
5 {file:test.db?mode=Rw} {no such access mode: Rw}
|
||||
6 {file:test.db?mode=Rwc} {no such access mode: Rwc}
|
||||
7 {file:test.db?mode=memory} {not an error}
|
||||
8 {file:test.db?mode=MEMORY} {no such access mode: MEMORY}
|
||||
" {
|
||||
do_test 7.$tn { open_uri_error $uri } $error
|
||||
}
|
||||
|
@ -1093,6 +1093,55 @@ do_test shared-$av-16.3 {
|
||||
SELECT * FROM t1;
|
||||
} db2
|
||||
} {1 {no such table: t1}}
|
||||
|
||||
# Shared cache on named memory databases.
|
||||
#
|
||||
do_test shared-$av-16.4 {
|
||||
db1 close
|
||||
db2 close
|
||||
forcedelete test.db test.db-wal test.db-journal
|
||||
sqlite3 db1 file:test.db?mode=memory -uri 1
|
||||
sqlite3 db2 file:test.db?mode=memory -uri 1
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
|
||||
}
|
||||
db2 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 2 3}
|
||||
do_test shared-$av-16.5 {
|
||||
db2 eval {
|
||||
INSERT INTO t1 VALUES(99);
|
||||
DELETE FROM t1 WHERE x=2;
|
||||
}
|
||||
db1 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 3 99}
|
||||
do_test shared-$av-16.6 {
|
||||
file exists test.db
|
||||
} {0} ;# Verify that the database is in-memory
|
||||
|
||||
# Shared cache on named memory databases with different names.
|
||||
#
|
||||
do_test shared-$av-16.7 {
|
||||
db1 close
|
||||
db2 close
|
||||
forcedelete test1.db test2.db
|
||||
sqlite3 db1 file:test1.db?mode=memory -uri 1
|
||||
sqlite3 db2 file:test2.db?mode=memory -uri 1
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
|
||||
}
|
||||
catchsql {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
} db2
|
||||
} {1 {no such table: t1}}
|
||||
do_test shared-$av-16.8 {
|
||||
file exists test1.db
|
||||
} {0} ;# Verify that the database is in-memory
|
||||
|
||||
|
||||
db1 close
|
||||
db2 close
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user