Is there an easy way to load a SQLite database from file to an in memory database, work on it in memory and then write the whole in memory database back to the database file?
Search the Xojo Blog site. @Geoff Perlman did a blog on how they do this for their Eddies web demo.
Hi Wayne, i have just search the Xojo blog for SQLite but cannot find any posts by Geoff or about Eddies web demo.
Perhaps it was before it became Xojo. Basically the steps are you create your in-memory database, attach the physical db and then use a bunch of select into statements to copy tables & data into your in-memory version. You would reverse the process to write the data back to the physical db file.
Thanks Wayne, that makes sense.
Javier wrote about it here.
I used to instantiate a sqlitedatabase object without database file, so it exists in memory. Then attach a database to it And select into the memory db from the file db.
Using the above mentioned BACKUP feature built in to SQLite is much easier, and faster… just 2 or 3 lines of code, and no need to worry about the schema layout (ie. you don’t need to know the table and field (oops row) names)
and AttachDatabase has been renamed to AddDatabase (even though SQLite themselves uses ATTACH)
AddDatabase sounds much more like CreateDatabase but …
Createing a NEW database connection would be “adding”… while “Attach” is exactly that… it extends a current connection
right … attach was the right word before and still is
but when you have to change something well …
dunno… but the word “STUPID” comes to mind