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