5477N/AQuick and dirty check that the module works (use actual
5477N/Aperl version instead of XXX)
5477N/A
5477N/A-------------------------------8<------------------------
5477N/AP='/usr/perl5/XXX/bin/perl -MDBD::SQLite'
5477N/ADB=/var/tmp/db.sql
5477N/AC="\$dbh=DBI->connect('dbi:SQLite:$DB');"
5477N/AFILE=/usr/bin/ls
5477N/A
5925N/A$P -e 'print $DBD::SQLite::VERSION, "\n"'
5925N/A
5477N/Arm -f "$DB"
5477N/A$P -e "$C"
5477N/Aif [ ! -e "$DB" ]; then
5477N/A echo "Fail - database not created"
5477N/A exit 1
5477N/Afi
5477N/A$P -e "$C"'
5477N/A $dbh->do("CREATE TABLE mytable( Bindata BLOB, date DATE)");
5477N/A $dbh->do("CREATE TRIGGER insert_blob_date AFTER INSERT ON mytable BEGIN UPDATE mytable SET date = DATETIME(\"NOW\"); END ;");
5477N/A'
5477N/A
5477N/A$P -e "$C"'
5477N/A my $blob = `cat '"$FILE"'`;
5477N/A my $sth = $dbh->prepare("INSERT INTO mytable VALUES (?, NULL)");
5477N/A $sth->bind_param(1, $blob, {TYPE => DBD::SQL_BLOB}
5477N/A);
5477N/A $sth->execute();
5477N/A'
5477N/A
5477N/A$P -MDigest::MD5 -e "$C"'
5477N/A $sth = $dbh->prepare("SELECT Bindata FROM mytable");
5477N/A $sth->execute();
5477N/A my $row = $sth->fetch;
5477N/A my $blobo = $row->[0];
5477N/A print Digest::MD5::md5_hex($blobo), "\n";
5477N/A'
5477N/A
5477N/A
5477N/Amd5sum "$FILE"
5477N/Aecho '.schema' | sqlite3 "$DB"
5477N/Aecho 'select date from mytable;' | sqlite3 "$DB"
5477N/A-------------------------------8<------------------------
5477N/A
5477N/A
5477N/AIt should print
5925N/A - correct DBD::SQLite version printed
5477N/A - two equal MD5 hashes
5477N/A - database description (mytable and trigger insert_blob_date)
5477N/A - current date and time