Lapsio
Lapsio

Reputation: 7064

SQlite shared in-memory database

I tried to create shared in-memory database for my multi threaded application and it doesn't seem to work. I used:

sqlite3_open("file:memdb1?mode=memory&cache=shared", &self->readdb)

Like it's described here: https://www.sqlite.org/inmemorydb.html However it just created regular file named file:memdb1?mode=memory&cache=shared which seems to be just normal file:

lapsio@linux-tiph > stat file:memdb1\?mode=memory\&cache=shared 
  File: 'file:memdb1?mode=memory&cache=shared'
  Size: 9216            Blocks: 24         IO Block: 4096   regular file
Device: 2fh/47d Inode: 109010      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/  lapsio)   Gid: (  100/   users)
Access: 2018-06-24 13:46:48.435300970 +0200
Modify: 2018-06-24 13:47:07.139406989 +0200
Change: 2018-06-24 13:47:07.139406989 +0200
 Birth: -

My SQlite version is

sqlite3 --version
3.8.10.2 2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4

Upvotes: 0

Views: 597

Answers (1)

Lapsio
Lapsio

Reputation: 7064

It requires File URI to be explicitly enabled by sqlite3_config(SQLITE_CONFIG_URI,1) as stated here: https://www.sqlite.org/uri.html

Upvotes: 1

Related Questions