@@ -8,15 +8,18 @@ require 'lib.pl';
8
8
9
9
use vars qw( $test_dsn $test_user $test_password) ;
10
10
11
+ DBI-> trace(100) if $ENV {TEST_VERBOSE };
12
+
11
13
my $dbh = DbiTestConnect($test_dsn , $test_user , $test_password ,
12
- { RaiseError => 1, PrintError => 0 });
14
+ { RaiseError => 1, PrintError => 1 });
13
15
$dbh -> disconnect;
14
16
15
- plan tests => (6 + ((5 + 8 + 8) * 4)) * 2;
17
+ # plan tests => (6 + ((5 + 8 + 8) * 4)) * 2;
18
+ plan tests => 936;
16
19
17
20
for my $mariadb_server_prepare (0, 1) {
18
21
$dbh = DBI-> connect (" $test_dsn ;mariadb_server_prepare=$mariadb_server_prepare ;mariadb_server_prepare_disable_fallback=1" , $test_user , $test_password ,
19
- { RaiseError => 1, PrintError => 0 });
22
+ { RaiseError => 1, PrintError => 1 });
20
23
21
24
ok $dbh -> do(" DROP TABLE IF EXISTS dbd_mysql_t50chopblanks" ), " drop table if exists dbd_mysql_t50chopblanks" ;
22
25
36
39
37
40
ok $dbh -> do($create ), " create table dbd_mysql_t50chopblanks" ;
38
41
42
+ for my $size (1 .. 8) {
43
+
39
44
my @fields = qw( c_text c_tinytext c_mediumtext c_longtext b_blob b_tinyblob b_mediumblob b_longblob) ;
40
45
my $numfields = scalar @fields ;
41
46
my $fieldlist = join (' , ' , @fields );
47
+ my $select_fields = join ' , ' , @fields [0 .. $size - 1];
42
48
43
49
ok (my $sth = $dbh -> prepare(" INSERT INTO dbd_mysql_t50chopblanks (id, $fieldlist ) VALUES (" .(' ?, ' x $numfields )." ?)" ));
50
+ note(' insert prepared' );
44
51
45
- ok (my $sth2 = $dbh -> prepare(" SELECT $fieldlist FROM dbd_mysql_t50chopblanks WHERE id = ?" ));
52
+ my $sth2 ;
53
+ eval {
54
+ $sth2 = $dbh -> prepare(" SELECT $select_fields FROM dbd_mysql_t50chopblanks WHERE id = ?" );
55
+ 1 } or die $dbh -> errstr;
56
+ note(' select prepared' );
46
57
47
58
my $rows ;
48
59
@@ -51,7 +62,7 @@ $rows = [ [1, ''], [2, ' '], [3, ' a b c '], [4, 'blah'] ];
51
62
for my $ref (@$rows ) {
52
63
my ($id , $value ) = @$ref ;
53
64
ok $sth -> execute($id , ($value ) x $numfields ), " insert into dbd_mysql_t50chopblanks values ($id " .(" , '$value '" x $numfields )." )" ;
54
- ok $sth2 -> execute($id ), " select $fieldlist from dbd_mysql_t50chopblanks where id = $id " ;
65
+ ok $sth2 -> execute($id ), " select $select_fields from dbd_mysql_t50chopblanks where id = $id " ;
55
66
56
67
# First try to retrieve without chopping blanks.
57
68
$sth2 -> {' ChopBlanks' } = 0;
@@ -74,7 +85,7 @@ for my $ref (@$rows) {
74
85
$choppedvalue =~ s /\s +$// if $character_field ; # only chop character, not binary
75
86
cmp_ok $ret_ref -> [$i ], ' eq' , $choppedvalue , " ChopBlanks: $fields [$i ] should " .($character_field ? " " : " not " )." have blanks chopped" ;
76
87
}
77
-
88
+ }
78
89
}
79
90
ok $dbh -> do(" DROP TABLE dbd_mysql_t50chopblanks" ), " drop dbd_mysql_t50chopblanks" ;
80
91
ok $dbh -> disconnect;
0 commit comments