1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-08 14:48:32 -04:00

Make sure we rollback

This commit is contained in:
Adam Kennedy 2009-04-04 02:56:41 +00:00
parent 193d8e8f52
commit 431109b9b4

View file

@ -9,17 +9,17 @@ BEGIN {
use Test::More tests => 26;
use t::lib::Test;
my $db = DBI->connect('dbi:SQLite:foo', '', '',
my $dbh = DBI->connect('dbi:SQLite:foo', '', '',
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 0,
});
ok($db);
ok($dbh);
ok($db->do("CREATE TABLE Blah ( id INTEGER, val VARCHAR )"));
ok($db->commit);
ok($dbh->do("CREATE TABLE Blah ( id INTEGER, val VARCHAR )"));
ok($dbh->commit);
my $blob = "";
@ -34,7 +34,7 @@ for my $i (0..127) {
ok($blob);
dumpblob($blob);
my $sth = $db->prepare("INSERT INTO Blah VALUES (?, ?)");
my $sth = $dbh->prepare("INSERT INTO Blah VALUES (?, ?)");
ok($sth);
@ -46,7 +46,7 @@ $sth->finish;
undef $sth;
my $sel = $db->prepare("SELECT * FROM Blah WHERE id = ?");
my $sel = $dbh->prepare("SELECT * FROM Blah WHERE id = ?");
ok($sel);
@ -59,6 +59,8 @@ for (1..5) {
ok(!$sel->fetch);
}
$dbh->rollback;
sub dumpblob {
my $blob = shift;
print("# showblob length: ", length($blob), "\n");