I am always getting back SQLITE_OK from this routine. It
is immaterial if I have open sqlite3* or even a currently
running statement (eg a "select .." sitting at SQLITE_ROW).
I am seeing this with both Windows and Linux.
The code is running in the Python environment. This is all
in the main thread. I am doing the following:
sqlite3_open("testdb")
prepare/step/finalize("create table foo(x)")
enable_shared_cache(1) # I expect this to fail according to docs
prepare/step/finalize("insert into foo values(?)", randomintegers(1))
prepare/step("select * from foo")
enable_shared_cache(0)
step previous statement
enable_shared_cache(1)
finalize previous statement
sqlite3_close
enable_shared_cache(1)
I even put printfs() in the C code. This is what I see, with
setting being the parameter passed to enable_shared_cache and
res being the result:
Setting=1 res=0
Setting=0 res=0
Setting=1 res=0
Setting=1 res=0
This is the C code for reference.
static PyObject *
enablesharedcache(PyObject *self, PyObject *args)
{
int setting,res;
if(!PyArg_ParseTuple(args, "i:enablesharedcache(boolean)", &setting))
return NULL;
res=sqlite3_enable_shared_cache(setting);
fprintf(stderr, "\nSetting=%d res=%d\n", setting, res);
SET_EXC(NULL, res);
if(res!=SQLITE_OK)
return NULL;
return Py_BuildValue("");
}
Any ideas? (I have also tried having two open sqlite3 handles and that didn't
make any difference)
Roger