Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
Message: 82758
BY: Eric Peterson (ericdp)
DATE: 2009-06-17 15:18
SUBJECT: .backup/.restore

 

since v.3.6.11 (I think) there has been a .backup/.restore set of commands. Below is an example on using these commands. I create a table, make a backup, delete the table, restore the table, and can see it back.

Would it be possible to add this to the wish list of new functionality so I can do them through this gem?

Thanks
Eric


C:\InWork\db>sqlite3 a.db
SQLite version 3.6.15
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

sqlite> CREATE TABLE a ( id INTEGER PRIMARY KEY );

sqlite> .schema a
CREATE TABLE a ( id integer PRIMARY KEY ); <-- we can see a table

sqlite> INSERT INTO a ( id ) VALUES ( 1 );

sqlite> SELECT * FROM a;
1

sqlite> .backup a.bck

sqlite> DROP TABLE a;

sqlite> .schema a
<-- no table here to see

sqlite> SELECT * FROM a;
SQL error: no such table: a

sqlite> .restore a.bck

sqlite> .schema a
CREATE TABLE a ( id integer PRIMARY KEY ); <-- and it is back,
YEAH! :)

sqlite> SELECT * FROM a;
1

sqlite> .quit


Thread View

Thread Author Date
.backup/.restoreEric Peterson2009-06-17 15:18

Post a followup to this message