Compressed SQLiteDatabase

If I create a zip archive of a SQLiteDatabase it ends up tiny, which is great :slight_smile: However when reading the (what is now a zip file), I have the option to read it directly into a NSData or with a sprinkling of declares a Xojo MemoryBlock, no need to write that to disk… Except, I can’t find a way to create a Xojo SQLitedatabase object from a memoryblock, I don’t need to modify the data, so read-only is fine.

Anyone know any tricks?

For an in-memory database you have to omit the folderitem.

For creating a blank database right? In this case I have the file date, it’s just stored in memory not on disk.

Well, technically we could write something, e.g. for MBS Plugins to allow reading from memory.
But that is a lot of work to just skip a temp file, which doesn’t hurt much.
Just write to temp folder, open it in SQLIte and then delete it (on macOS and Linux you can delete it usually before closing it).

(Noting that I’m not an expert on SQLite…)

What if you dumped your data and stored the dump into the MemoryBlock? Then you can perform a ExecuteSQL on the data to restore you database.

1 Like