Showing posts with label sqlite. Show all posts
Showing posts with label sqlite. Show all posts

Wednesday, August 4, 2010

Perl and SQLite

Finally got around to finishing my little SQLite and Perl program.  To speed things up, I used a shell script with remote SSH commands to grab the data, then used Perl to stuff it into SQLite.  Very cool!   Need to use Perl's Net-SNMP on next version but this was mainly an excuse to use SQLite.  Glad I did.  There's a lot of strangeness - can't get used to putting a dot in front of commands and many of my favorite SQL commands are missing or renamed.  Still - SO COOL to be able to create a database on the fly like that.

Want to delete all tables in SQLite?

You can do it with the following DANGEROUS commands:

PRAGMA writable_schema = 1;
delete from sqlite_master where type = 'table';
PRAGMA writable_schema = 0;
 
you then want to recover the deleted space with

VACUUM

and a good test to make sure everything is ok

PRAGMA INTEGRITY_CHECK;
 
Found this on the Internet but haven't ran across it elsewhere.