2

I'm currently using an in-memory(https://www.sqlite.org/inmemorydb.html) database because I cannot guarantee write access.

But in order to save the database, how do I convert the in-memory database to a byte array and potentially save it to file later when I do have write access? Thanks!

The database is created like in the example:

rc = sqlite3_open("file::memory:", &db);

I want to take db and save into a byte array. Then, save the byte array to a file. Then load from the file like normal:

int sqlite3_open_v2(filename_of_saved_db, ppDb, flags, zVfs);

(using c++, but examples in any other language should work as well i assume)

jasonz001
  • 21
  • 3
  • Giving a snippet of code to describe how you created the in-memory database may help people give you an answer. – scicalculator Nov 19 '16 at 00:02
  • @scicalculator Thanks for the reply, the database is created normally. `rc = sqlite3_open("file::memory:", &db);` – jasonz001 Nov 19 '16 at 00:32

0 Answers0