My technical and personal observations about softwares and other entities

Thursday, July 21

sqlite database and perl

Some lines of perl scripts which can be used to connect to sqlite database.

Just connection
$adbh = DBI->connect( "dbi:SQLite:action_database.db" ) || die "could not connect to the action database: $DBI::errstr";

Inserting some records..

my $esql = "INSERT INTO eventtable (ActionID, Event, Notified, Due) values (?, ?, ?, ?)";
my $esth = undef;
eval{
$esth= $edbh->prepare($esql) or die "Not able to prepare $esql";
$esth->execute($actionid, $event, 'N', $duedatetime) or die "Not able to execute $esql";
};
if ($@) { print "ERROR: $@\n"; }

Updating some records

my $asql = "UPDATE actiontable set Owner = ?, Due = ?, Notify = ?, Status = ?, Description = ? WHERE ActionID == ? ";

No comments: