mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
afc07b9339
* Proof of concept of sqlite serialization This is a minimal proof of concept in order to show that it is easily possible to store the sqlite database within the zip file itself not requiring creating an external file first. Changes include compiling the sqlite library with the serialization flag, adding serialize/deserialize to the lua sqlite library and demonstrating the work via the redbean demo. * Change demo for sqlite serialization As explained in https://github.com/jart/cosmopolitan/pull/436#issuecomment-1164706893 the original use case is not possible with sqlite serialization, as an in-memory database cannot be shared across multiple processes. Thereby, this use case simply creates a backup of the in-memory database created in '.init.lua' and loads it to do a query. * Fix sqlite3_deserialize parameters The call to the sqlite3 library for the deserilization wasn't fully correct. This should fix the size parameters.
4 lines
No EOL
125 B
Lua
4 lines
No EOL
125 B
Lua
buffer = db:serialize()
|
|
StoreAsset("backup.sqlite3", buffer)
|
|
|
|
Write("backup created. size: "..GetAssetSize("backup.sqlite3")) |