I'm attempting to load a database in the memory rather than opening b .sqlite file. I've browse the C/C++ API reference but I am unable to discover the proper method.

The buffer I'm attempting to load is just an sqlite file loaded in memory. Among the finest to make use of this buffer (a const char* array) without needing the filesystem (I possibly could have saved this buffer inside a file, then load the file, but no).

First, I produce a memory DB : mErrorCode = sqlite3_open_v2(":memory:", &mSqlDatabase, lMode, NULL);

This returns SQLITE_OK, i quickly attempted to make use of the buffer like a statement and call preparev2(MyDB, MyBufferData, MyBufferLength, MyStatement, NULL) but it is not just a statement, also it returns a mistake. Same result basically call directly exec(MyDB, MyBufferData, NULL, NULL, NULL);

I suppose there's a suitable method to do this as it can be present with load a DB from the stream or from decrypted data...


In my opinion that the best way to do that would be to create an SQLite VFS layer around your buffer, as pointed out in this thread. A potentialOrincomplete solution, spmemvfs, is pointed out here, although I have not attempted it.

If you do not need concurrency for the DB, creating your personal VFS implementation ought to be fairly simple.