Skip to content

Commit 67db714

Browse files
committed
Remove wrong usage of $sth->finish() from all tests
According to DBI documentation $sth->finish() should not be called after fetching all data.
1 parent 336977d commit 67db714

39 files changed

+33
-131
lines changed

t/30insertfetch.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ ok($sth->execute());
4040

4141
ok(not $sth->fetchrow_arrayref());
4242

43-
ok($sth->finish());
44-
4543
ok($dbh->disconnect());
4644

4745
done_testing;

t/31insertid.t

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require "lib.pl";
1111
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1212
{ RaiseError => 1, PrintError => 0 });
1313

14-
plan tests => 3 + 2*37;
14+
plan tests => 3 + 2*35;
1515

1616
SKIP: {
1717
skip 'SET @@auto_increment_offset needs MySQL >= 5.0.2', 2 unless $dbh->{mariadb_serverversion} >= 50002;
@@ -87,9 +87,6 @@ is $sth->last_insert_id(), 2, "second insert id == \$sth->last_insert_id()";
8787
is $sth3->{mariadb_insertid}, 3, "third insert id == \$sth3->{mariadb_insertid}";
8888
is $sth3->last_insert_id(), 3, "third insert id == \$sth3->last_insert_id()";
8989

90-
ok $sth->finish();
91-
ok $sth2->finish();
92-
9390
ok $dbh->do('DROP TEMPORARY TABLE dbd_mysql_t31');
9491

9592
}

t/32insert_error.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use vars qw($test_dsn $test_user $test_password);
1111
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1212
{ RaiseError => 1, PrintError => 0 });
1313

14-
plan tests => 9;
14+
plan tests => 8;
1515

1616
ok $dbh->do("DROP TABLE IF EXISTS dbd_mysql_t32");
1717

@@ -33,8 +33,6 @@ ok $failed, 'fails with duplicate entry';
3333

3434
ok $sth->execute(2, "Jochen");
3535

36-
ok $sth->finish;
37-
3836
ok $dbh->do("DROP TABLE dbd_mysql_t32");
3937

4038
ok $dbh->disconnect();

t/35limit.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require 'lib.pl';
1414

1515
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1616
{ RaiseError => 1, PrintError => 0, AutoCommit => 0 });
17-
plan tests => 111;
17+
plan tests => 110;
1818

1919
ok(defined $dbh, "Connected to database");
2020

@@ -44,8 +44,6 @@ ok( (defined($array_ref = $sth->fetchall_arrayref) &&
4444

4545
ok(@$array_ref == 50);
4646

47-
ok($sth->finish);
48-
4947
ok($dbh->do("DROP TABLE dbd_mysql_t35"));
5048

5149
ok($dbh->disconnect);

t/35prepare.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use vars qw($test_dsn $test_user $test_password);
1313
$dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1414
{ RaiseError => 1, PrintError => 0 });
1515

16-
plan tests => 49;
16+
plan tests => 47;
1717

1818
ok(defined $dbh, "Connected to database");
1919

@@ -45,8 +45,6 @@ ok(($rows = $sth->execute()), "Inserting second row");
4545

4646
ok($rows == 1, "One row should have been inserted");
4747

48-
ok($sth->finish, "Finishing up with statement handle");
49-
5048
ok($sth= $dbh->prepare("SELECT id, name FROM dbd_mysql_t35prepare WHERE id = 1"),
5149
"Testing prepare of query");
5250

@@ -69,8 +67,6 @@ for (my $i = 0 ; $i < 10; $i++)
6967
ok($rows= 1, "Should have inserted one row");
7068
}
7169

72-
ok($sth->finish, "Testing closing of statement handle");
73-
7470
ok($sth= $dbh->prepare("SELECT * FROM dbd_mysql_t35prepare WHERE id = ? OR id = ?"),
7571
"Testing prepare of query with placeholders");
7672

t/40bindparam.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use vars qw($test_dsn $test_user $test_password);
1010
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1111
{ RaiseError => 1, PrintError => 0 });
1212

13-
plan tests => 41;
13+
plan tests => 40;
1414

1515
ok ($dbh->do("DROP TABLE IF EXISTS dbd_mysql_t40bindparam"));
1616

@@ -109,6 +109,4 @@ cmp_ok $name, 'eq', '?', "\$name set to '?'";
109109

110110
ok ($dbh->do("DROP TABLE dbd_mysql_t40bindparam"));
111111

112-
ok $sth->finish;
113-
114112
ok $dbh->disconnect;

t/40bindparam2.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require 'lib.pl';
1010
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1111
{ RaiseError => 1, PrintError => 0 });
1212

13-
plan tests => 14;
13+
plan tests => 13;
1414

1515
SKIP: {
1616
skip 'SET @@auto_increment_offset needs MySQL >= 5.0.2', 2 unless $dbh->{mariadb_serverversion} >= 50002;
@@ -41,8 +41,6 @@ ok ($sth->bind_param(2, 1, DBI::SQL_INTEGER()));
4141

4242
ok ($sth->execute());
4343

44-
ok ($sth->finish());
45-
4644
ok ($rows = $dbh->selectall_arrayref("SELECT * FROM dbd_mysql_t40bindparam2"));
4745

4846
ok !defined($rows->[0][1]);

t/40bit.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if ($dbh->{mariadb_serverversion} < 50008) {
1414
plan skip_all => "Servers < 5.0.8 do not support b'' syntax";
1515
}
1616

17-
plan tests => 15;
17+
plan tests => 14;
1818

1919
ok $dbh->do("DROP TABLE IF EXISTS dbd_mysql_b1"), "Drop table if exists dbd_mysql_b1";
2020

@@ -36,8 +36,6 @@ is $result->[0][0], 11111111, "should be 11111111";
3636
is $result->[1][0], 1010, "should be 1010";
3737
is $result->[2][0], 101, "should be 101";
3838

39-
ok ($sth->finish);
40-
4139
ok $dbh->do("DROP TABLE dbd_mysql_b1"), "Drop table dbd_mysql_b1";
4240

4341
ok $dbh->disconnect;

t/40blobs.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ sub ShowBlob($) {
2424
my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
2525
{ RaiseError => 1, PrintError => 0 });
2626

27-
plan tests => 14;
27+
plan tests => 13;
2828

2929
my $size= 128;
3030

@@ -70,8 +70,6 @@ cmp_ok byte_string($$row[1]), 'eq', byte_string($blob), 'blob set equal to blob
7070

7171
ShowBlob($blob), ShowBlob(defined($$row[1]) ? $$row[1] : "");
7272

73-
ok ($sth->finish);
74-
7573
ok $dbh->do("DROP TABLE dbd_mysql_t40blobs"), "Drop table dbd_mysql_t40blobs";
7674

7775
ok $dbh->disconnect;

t/40nulls.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require 'lib.pl';
1010
my ($dbh, $sth);
1111
$dbh = DbiTestConnect($test_dsn, $test_user, $test_password,
1212
{ RaiseError => 1, PrintError => 0, AutoCommit => 0 });
13-
plan tests => 10;
13+
plan tests => 9;
1414

1515
ok $dbh->do("DROP TABLE IF EXISTS dbd_mysql_t40nulls"), "DROP TABLE IF EXISTS dbd_mysql_t40nulls";
1616

@@ -34,8 +34,6 @@ ok !defined($$aref[0]);
3434

3535
ok defined($$aref[1]);
3636

37-
ok $sth->finish;
38-
3937
ok $dbh->do("DROP TABLE dbd_mysql_t40nulls");
4038

4139
ok $dbh->disconnect;

0 commit comments

Comments
 (0)