From 4ab9d254e066247855b8907d001b9994aa072f1f Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 26 May 2012 20:08:49 +0000 Subject: Only allow :memory: databases to share cache if there are created using a URI filename. This minimizes the risk of breakages in legacy applications that have shared-cache enabled but also use :memory: databases which they expect to keep separate. FossilOrigin-Name: e3ad61e0308a8442c2bdb7cdb3465576cd39ed4a --- src/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index d148b4b42..c8fda4787 100644 --- a/src/main.c +++ b/src/main.c @@ -2055,6 +2055,7 @@ int sqlite3ParseUri( memcpy(zFile, zUri, nUri); zFile[nUri] = '\0'; zFile[nUri+1] = '\0'; + flags &= ~SQLITE_OPEN_URI; } *ppVfs = sqlite3_vfs_find(zVfs); -- cgit v1.2.3 From 9c67b2aae06e8571e8c5faa8968fab8286a70672 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 28 May 2012 13:58:00 +0000 Subject: 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 --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index c8fda4787..4e9a605f4 100644 --- a/src/main.c +++ b/src/main.c @@ -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; -- cgit v1.2.3