On 2 Oct 2009, at 5:20pm, Ned Fleming wrote:

> Is it possible to dump an in-memory sqlite database (or table?) to a
> file from within Tcl?

Not easily.  MySQL has a pseudo-command which does what .dump does:  
returns a long piece of text with all the commands needed to reproduce  
the table.  If I suggest adding this as a PRAGMA people will scream  
'bloat'.  In SQLite it's easy to find the command needed to create the  
TABLE and INDEXes, but what's hard is devising a short way to recreate  
the records.

> I have tried the following (and variations) -- but no go, kokomo.
> ($fileOut3 is a handle to a command-line file name.)
>
>       exec sqlite3 dump dbFireData $fileOut3

 From a shell:

echo '.dump' | sqlite3 mydb.sql > mydb.dump

echo '.dump' | sqlite3 mydb.sql | gzip -c > mydb.dump.gz

I don't know enough about Tcl to know if you can do piping and routing  
in its 'exec' commands.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to