On 5/30/08, Mark Stewart <[EMAIL PROTECTED]> wrote: > > Is there a recommended way to save an in-memory database to a file? Is there > a way to access the underlying in-memory data directly to save out to disk > (if that would even work)? > > My other thought was to create an empty file based db and attach it, > creating tables and transferring all the data through sql. > > Maybe there is some other option? >
[12:04 AM] ~/foo$ ls [12:04 AM] ~/foo$ sqlite3 SQLite version 3.5.6 Enter ".help" for instructions sqlite> CREATE TABLE t (a, b); sqlite> INSERT INTO t VALUES (1, 'one'); sqlite> INSERT INTO t VALUES (2, 'two'); sqlite> SELECT * FROM t; 1|one 2|two sqlite> .q [12:04 AM] ~/foo$ ls [12:04 AM] ~/foo$ sqlite3 SQLite version 3.5.6 Enter ".help" for instructions sqlite> CREATE TABLE t (a, b); sqlite> INSERT INTO t VALUES (1, 'one'); sqlite> INSERT INTO t VALUES (2, 'two'); sqlite> SELECT * FROM t; 1|one 2|two sqlite> .o foo.sql sqlite> .dump sqlite> .q [12:05 AM] ~/foo$ ls foo.sql 12:05 AM] ~/foo$ cat foo.sql BEGIN TRANSACTION; CREATE TABLE t (a, b); INSERT INTO "t" VALUES(1,'one'); INSERT INTO "t" VALUES(2,'two'); COMMIT; [12:06 AM] ~/foo$ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users