Small. Fast. Reliable.
Choose any three.
*** 1,5 ****
--- 1,24 ----
  This page is about using in-memory SQLite databases.
  ----
+ 2006-02-20: A simple TCL-Implementation for loading a DB into memory:
+ 
+ proc loadDB {dbhandle filename} {
+ 
+     if {$filename != ""} {
+         #attach persistent DB to target DB
+         $dbhandle eval "ATTACH DATABASE '$filename' AS loadfrom"
+         #copy each table to the target DB
+         foreach {tablename} [$dbhandle eval "SELECT name FROM loadfrom.sqlite_master WHERE type = 'table'"] {
+             $dbhandle eval "CREATE TABLE '$tablename' AS SELECT * FROM loadfrom.'$tablename'"
+         }
+         #create indizes in loaded table
+         foreach {sql_exp} [$dbhandle eval "SELECT sql FROM loadfrom.sqlite_master WHERE type = 'index'"] {
+             $dbhandle eval $sql_exp
+         }
+         #detach the source DB
+         $dbhandle eval {DETACH loadfrom}
+     }
+ }
  
  2006-01-07: I want to read a database from file to memory and use it
  via :memory: - can I do that?