diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-09-24 10:15:50 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:46 +0000 |
commit | 485b97be9f2f2abf5a40923b5fd85f75714a8c02 (patch) | |
tree | ca05cb0ecf3828d909a898c3e5805804a0aff5f8 /t/rt_21406_auto_finish.t | |
download | perl-dbd-sqlite-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/perl-dbd-sqlite-tarball/DBD-SQLite-1.38_01.tar.gz.HEADDBD-SQLite-1.38_01masterbaserock/morph
Diffstat (limited to 't/rt_21406_auto_finish.t')
-rw-r--r-- | t/rt_21406_auto_finish.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/rt_21406_auto_finish.t b/t/rt_21406_auto_finish.t new file mode 100644 index 0000000..b621391 --- /dev/null +++ b/t/rt_21406_auto_finish.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +use t::lib::Test; +use Test::More tests => 11; +use Test::NoWarnings; + +SCOPE: { + my $dbh = connect_ok( RaiseError => 1 ); + $dbh->do("CREATE TABLE f (f1, f2, f3)"); + $dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 1); + $dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 2); + $dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 3); + $dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 4); + $dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 5); + + my $sth1 = $dbh->prepare_cached('SELECT * FROM f ORDER BY f3', {}); + isa_ok( $sth1, 'DBI::st' ); + ok( $sth1->execute, '->execute ok' ); + is_deeply( $sth1->fetchrow_arrayref, [ 'foo', 'bar', 1 ], 'Row 1 ok' ); + is_deeply( $sth1->fetchrow_arrayref, [ 'foo', 'bar', 2 ], 'Row 2 ok' ); + + my $sth2 = $dbh->prepare_cached('SELECT * FROM f ORDER BY f3', {}, 3); + isa_ok( $sth2, 'DBI::st' ); + ok( $sth2->execute, '->execute ok' ); + is_deeply( $sth2->fetchrow_arrayref, [ 'foo', 'bar', 1 ], 'Row 1 ok' ); + is_deeply( $sth2->fetchrow_arrayref, [ 'foo', 'bar', 2 ], 'Row 2 ok' ); + ok( $sth2->finish, '->finish ok' ); +} |