@@ -13,9 +13,11 @@ use vars qw($test_dsn $test_user $test_password);
13
13
$dbh = DbiTestConnect($test_dsn , $test_user , $test_password ,
14
14
{ RaiseError => 1, PrintError => 0 });
15
15
16
- plan tests => 47 ;
16
+ plan tests => 5+2*63 ;
17
17
18
- ok(defined $dbh , " Connected to database" );
18
+ for my $mariadb_server_prepare (0, 1) {
19
+
20
+ $dbh -> {mariadb_server_prepare } = $mariadb_server_prepare ;
19
21
20
22
ok($dbh -> do(" DROP TABLE IF EXISTS dbd_mysql_t35prepare" ), " Making slate clean" );
21
23
@@ -79,11 +81,41 @@ ok($ret_ref = $sth->fetchall_arrayref(),
79
81
note " RETREF " . scalar @$ret_ref . " \n " ;
80
82
ok(@{$ret_ref } == 4 , " \$ ret_ref should contain four rows in result set" );
81
83
84
+ # Check that repeated $sth->execute + $sth->fetchall_arrayref work as expected
85
+ ok($sth = $dbh -> prepare(" SELECT * FROM dbd_mysql_t35prepare LIMIT 2" ));
86
+ ok($sth -> execute());
87
+ is_deeply($sth -> fetchall_arrayref(), [ [ 1, ' 1st first value' ], [ 2, ' 2nd second value' ] ]);
88
+ ok($sth -> execute());
89
+ is_deeply($sth -> fetchall_arrayref(), [ [ 1, ' 1st first value' ], [ 2, ' 2nd second value' ] ]);
90
+ ok($sth -> execute());
91
+ is_deeply($sth -> fetchall_arrayref(), [ [ 1, ' 1st first value' ], [ 2, ' 2nd second value' ] ]);
92
+
93
+ # Check that repeated $sth->execute + $sth->fetchrow_arrayref work as expected
94
+ ok($sth = $dbh -> prepare(" SELECT * FROM dbd_mysql_t35prepare LIMIT 3" ));
95
+ ok($sth -> execute());
96
+ is_deeply($sth -> fetchrow_arrayref(), [ 1, ' 1st first value' ]);
97
+ is_deeply($sth -> fetchrow_arrayref(), [ 2, ' 2nd second value' ]);
98
+ ok($sth -> finish());
99
+ ok($sth -> execute());
100
+ is_deeply($sth -> fetchrow_arrayref(), [ 1, ' 1st first value' ]);
101
+ is_deeply($sth -> fetchrow_arrayref(), [ 2, ' 2nd second value' ]);
102
+ ok($sth -> finish());
103
+
104
+ # Check that repeated calls of $dbh->selectcol_arrayref, $dbh->prepare and $dbh->prepare_cached work as expected
105
+ is_deeply($dbh -> selectcol_arrayref(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" ), [ 1, 2 ]);
106
+ is_deeply($dbh -> selectcol_arrayref(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" ), [ 1, 2 ]);
107
+ is_deeply($dbh -> selectcol_arrayref($dbh -> prepare(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" )), [ 1, 2 ]);
108
+ is_deeply($dbh -> selectcol_arrayref($dbh -> prepare(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" )), [ 1, 2 ]);
109
+ is_deeply($dbh -> selectcol_arrayref($dbh -> prepare_cached(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" )), [ 1, 2 ]);
110
+ is_deeply($dbh -> selectcol_arrayref($dbh -> prepare_cached(" SELECT id FROM dbd_mysql_t35prepare LIMIT 2" )), [ 1, 2 ]);
111
+
82
112
ok($sth = $dbh -> prepare(" DROP TABLE IF EXISTS dbd_mysql_t35prepare" ),
83
113
" Testing prepare of dropping table" );
84
114
85
115
ok($sth -> execute(), " Executing drop table" );
86
116
117
+ }
118
+
87
119
# Bug #20153: Fetching all data from a statement handle does not mark it
88
120
# as finished
89
121
ok($sth = $dbh -> prepare(" SELECT 1" ), " Prepare - Testing bug #20153" );
0 commit comments