perl - in-memory-only modifications to an SQLite database -


SQLite supplied externally to 9k pages for a statically serving website With the database.

, but for the sake of stability, I think it will make more sense if my scripts are left out of the original database alone, and only modify the data in memory (if necessary, even whole The database should fit in the RAM without problems), first to prepare web pages.

How can I do this?

I smell that I can benefit from some type of SQL transaction here (which should have been left after my script), is that right? Looking at the barrier of keeping the original database file unconnected, is this a good idea? (Eg, how and how the current transaction data is stored when using SQLite from Perl?) Any other way of completing what I need? (I'm a Perl and SQL novice - Looking for an annotated code sample.)

The last resort I think is that I can always copy the database file in the file system, but it seems That ugly and inefficient solution.

I have not tested this, but you should be able to use your database in memory Load it: You can probably open : memory: (or "" for a temporary, file-supported db), and then call to load the database in one shot.

eg (Untested)

  My $ db = db-> Connect ("DBI: SQLite: dbname =: Memory:", '', '', {}); $ Db- & gt; Sqlite_backup_from_file ($ ENV {database}); # Database should be loaded in current memory db at this time.  

Comments