@@ -17,7 +17,7 @@ if ($dbh->{mariadb_serverversion} < 50002) {
17
17
" SKIP TEST: You must have MySQL version 5.0.2 and greater for this test to run" ;
18
18
}
19
19
# nostrict tests + strict tests + init/tear down commands
20
- plan tests => (19*8 + 19*8 + 4 ) * 2;
20
+ plan tests => (19*8 + 19*8 + 3 ) * 2;
21
21
22
22
my $table = ' dbd_mysql_t41minmax' ; # name of the table we will be using
23
23
my $mode ; # 'strict' or 'nostrict' corresponds to strict SQL mode
@@ -26,9 +26,8 @@ sub test_int_type ($$$$) {
26
26
my ($perl_type , $mariadb_type , $min , $max ) = @_ ;
27
27
28
28
# Create the table
29
- ok($dbh -> do(qq{ DROP TABLE IF EXISTS $table } ), " removing $table " );
30
29
ok($dbh -> do(qq{
31
- CREATE TABLE `$table ` (
30
+ CREATE TEMPORARY TABLE `$table ` (
32
31
`id` int not null auto_increment,
33
32
`val` $mariadb_type ,
34
33
primary key (id)
@@ -38,7 +37,7 @@ sub test_int_type ($$$$) {
38
37
my ($store , $retrieve ); # statements
39
38
my $read_value ; # retrieved value
40
39
ok($store = $dbh -> prepare(" INSERT INTO $table (val) VALUES (?)" ));
41
- ok($retrieve = $dbh -> prepare(" SELECT val from $table where id=(SELECT MAX(id) FROM $table ) " ));
40
+ ok($retrieve = $dbh -> prepare(" SELECT val from $table ORDER BY id DESC LIMIT 1 " ));
42
41
43
42
# #######################################
44
43
# Insert allowed min value
@@ -107,6 +106,8 @@ sub test_int_type ($$$$) {
107
106
($read_value ) = $retrieve -> fetchrow_array();
108
107
cmp_ok($read_value , ' eq' , $max , " retrieved maximal value for type $mariadb_type , mode=$mode " );
109
108
};
109
+
110
+ ok($dbh -> do(qq{ DROP TEMPORARY TABLE `$table `} ), " removing $table " );
110
111
}
111
112
112
113
$dbh -> disconnect;
@@ -141,7 +142,5 @@ test_int_type(DBI::SQL_INTEGER, 'int unsigned', 0, 2**32-1);
141
142
test_int_type(DBI::SQL_BIGINT, ' bigint signed' , -2**63, 2**63-1);
142
143
test_int_type(DBI::SQL_BIGINT, ' bigint unsigned' , 0, 2**64-1);
143
144
144
- ok ($dbh -> do(" DROP TABLE $table " ));
145
-
146
145
ok $dbh -> disconnect;
147
146
}
0 commit comments