File: rt_21406_auto_finish.t

package info (click to toggle)
libdbd-sqlite3-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,004 kB
  • sloc: ansic: 167,715; perl: 1,788; pascal: 277; makefile: 9
file content (31 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More;
use if -d ".git", "Test::FailWarnings";

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' );
}

done_testing;