diff --git a/t/02_logon.t b/t/02_logon.t index 58e57bf..45a2af1 100644 --- a/t/02_logon.t +++ b/t/02_logon.t @@ -18,5 +18,3 @@ diag("sqlite_version=$dbh->{sqlite_version}"); ok( $dbh->func('busy_timeout'), 'Found initial busy_timeout' ); ok( $dbh->func(5000, 'busy_timeout') ); is( $dbh->func('busy_timeout'), 5000, 'Set busy_timeout to new value' ); - -$dbh->disconnect; diff --git a/t/03_create_table.t b/t/03_create_table.t index 24ecf7b..e57bfc1 100644 --- a/t/03_create_table.t +++ b/t/03_create_table.t @@ -14,13 +14,9 @@ use t::lib::Test; my $dbh = connect_ok(); $dbh->do("CREATE TABLE f (f1, f2, f3)"); -SCOPE: { - my $sth = $dbh->prepare("SELECT f.f1, f.* FROM f"); - isa_ok( $sth, 'DBI::st' ); - ok( $sth->execute, '->execute ok' ); - my $names = $sth->{NAME}; - is( scalar(@$names), 4, 'Got 4 columns' ); - is_deeply( $names, [ 'f1', 'f1', 'f2', 'f3' ], 'Table prepending is disabled by default' ); -} - -$dbh->disconnect; +my $sth = $dbh->prepare("SELECT f.f1, f.* FROM f"); +isa_ok( $sth, 'DBI::st' ); +ok( $sth->execute, '->execute ok' ); +my $names = $sth->{NAME}; +is( scalar(@$names), 4, 'Got 4 columns' ); +is_deeply( $names, [ 'f1', 'f1', 'f2', 'f3' ], 'Table prepending is disabled by default' ); diff --git a/t/04_insert.t b/t/04_insert.t index aeb41d1..7489348 100644 --- a/t/04_insert.t +++ b/t/04_insert.t @@ -25,12 +25,10 @@ SCOPE: { is( $sth->execute("test", "test", "3"), 1 ); SKIP: { - skip( 'last_insert_id requires DBI v1.43', 2 ) if $DBI::VERSION < 1.43; - is( $dbh->last_insert_id(undef, undef, undef, undef), 4 ); - is( $dbh->func('last_insert_rowid'), 4, 'last_insert_rowid should be 4' ); + skip( 'last_insert_id requires DBI v1.43', 2 ) if $DBI::VERSION < 1.43; + is( $dbh->last_insert_id(undef, undef, undef, undef), 4 ); + is( $dbh->func('last_insert_rowid'), 4, 'last_insert_rowid should be 4' ); } } is( $dbh->do("delete from f where f1='test'"), 3 ); - -$dbh->disconnect; diff --git a/t/05_select.t b/t/05_select.t index 01a497c..0945b16 100644 --- a/t/05_select.t +++ b/t/05_select.t @@ -58,6 +58,4 @@ while ($row = $sth->fetch) { } ok($num_rows == 1); $sth->finish; -undef $sth; $dbh->do("delete from f where f1='test'"); -$dbh->disconnect; diff --git a/t/06_tran.t b/t/06_tran.t index 1ae5378..94ef2ce 100644 --- a/t/06_tran.t +++ b/t/06_tran.t @@ -27,19 +27,15 @@ $dbh->do("INSERT INTO TRN VALUES('C', 1, 4)"); $dbh->do("INSERT INTO TRN VALUES('D', 3, 3)"); $dbh->rollback; #not work? -SCOPE: { - my $sth = $dbh->prepare( - "SELECT TRN.id AS ID, MST.LBL AS TITLE, - SUM(qty) AS TOTAL FROM TRN,MST - WHERE TRN.ID = MST.ID - GROUP BY TRN.ID ORDER BY TRN.ID DESC"); - my $rows = $sth->execute(); - ok($rows, "0E0"); - my $names = $sth->{NAME}; - print(join(', ', @$names), "\n"); - while(my $raD = $sth->fetchrow_arrayref()) { - print join(":", @$raD), "\n"; - } +my $sth = $dbh->prepare( +"SELECT TRN.id AS ID, MST.LBL AS TITLE, + SUM(qty) AS TOTAL FROM TRN,MST +WHERE TRN.ID = MST.ID +GROUP BY TRN.ID ORDER BY TRN.ID DESC"); +my $rows = $sth->execute(); +ok($rows, "0E0"); +my $names = $sth->{NAME}; +print(join(', ', @$names), "\n"); +while(my $raD = $sth->fetchrow_arrayref()) { + print join(":", @$raD), "\n"; } - -$dbh->disconnect; diff --git a/t/09_create_function.t b/t/09_create_function.t index ac766ea..b0c60cd 100644 --- a/t/09_create_function.t +++ b/t/09_create_function.t @@ -115,5 +115,3 @@ is_deeply( $result, [ '' ], "SELECT noop('')" ); $result = $dbh->selectrow_arrayref( "SELECT noop(1.0625)" ); is_deeply( $result, [ 1.0625 ], "SELECT noop(1.0625)" ); - -$dbh->disconnect; diff --git a/t/12_unicode.t b/t/12_unicode.t index ddd03eb..1af5b64 100644 --- a/t/12_unicode.t +++ b/t/12_unicode.t @@ -126,4 +126,3 @@ Test($lengths->[0]->[0] == $lengths->[0]->[1], warn "($lengths->[0]->[0] != $lengths->[0]->[1])"; $dbh->do("DROP TABLE $table"); -$dbh->disconnect; diff --git a/t/13_create_collation.t b/t/13_create_collation.t index c36c480..8fd5ecc 100644 --- a/t/13_create_collation.t +++ b/t/13_create_collation.t @@ -98,5 +98,3 @@ is_deeply(\@sorted, $db_sorted, "collate perllocale (@sorted // @$db_sorted)"); @sorted = sort no_accents @words_utf8; $db_sorted = $dbh->selectcol_arrayref("$sql COLLATE no_accents"); is_deeply(\@sorted, $db_sorted, "collate no_accents (@sorted // @$db_sorted)"); - -$dbh->disconnect; diff --git a/t/14_progress_handler.t b/t/14_progress_handler.t index 88412e4..39ae3b8 100644 --- a/t/14_progress_handler.t +++ b/t/14_progress_handler.t @@ -45,5 +45,3 @@ $result = $dbh->do( "SELECT * from progress_test ORDER BY foo DESC " ); # now the progress handler should have been called zero times ok(!$n_callback); - -$dbh->disconnect; diff --git a/t/21_blobtext.t b/t/21_blobtext.t index da8612f..2f21eb4 100644 --- a/t/21_blobtext.t +++ b/t/21_blobtext.t @@ -59,12 +59,6 @@ for (1..5) { ok(!$sel->fetch); } -$sel->finish; - -undef $sel; - -$db->disconnect; - sub dumpblob { my $blob = shift; print("# showblob length: ", length($blob), "\n"); diff --git a/t/rt_21406_auto_finish.t b/t/rt_21406_auto_finish.t index c616925..9c28060 100644 --- a/t/rt_21406_auto_finish.t +++ b/t/rt_21406_auto_finish.t @@ -24,18 +24,14 @@ $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); -SCOPE: { - 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' ); -} - -$dbh->disconnect; +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' );