Skip to content

Commit 11effb0

Browse files
myrrhlindveeden
authored andcommitted
set index offset for when gh#447 is fixed
ParamValues attribute is a hashref whose keys should be integers startign with 1, for the placeholders in the prepared statement.
1 parent be23873 commit 11effb0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

t/gh447-paramvalues.t

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ END {
3131
}
3232
}
3333

34+
# this is the starting index for the placeholder keys
35+
# in the ParamValues attribute hashref. gh#447 showed
36+
# the keys begin counting with 0, but DBI requires they
37+
# start counting at 1.
38+
# so, if this value is 0, tests pass under DBD::mysql 4.050.
39+
# but the value should be 1, when the issue is fixed.
40+
my $ofs = 1;
41+
3442
# ------ set up
3543
ok(defined $dbh, "Connected to database");
3644
$dbh->do("DROP TABLE IF EXISTS $table");
@@ -50,8 +58,6 @@ undef $sth;
5058

5159

5260
# test prepare/execute statement with a placeholder
53-
my $ofs = 0;
54-
5561
$sth = $dbh->prepare("INSERT INTO $table values (?, ?)");
5662
is_deeply($sth->{ParamValues}, {0+$ofs => undef, 1+$ofs => undef},
5763
"ParamValues is correct hashref before INSERT")

0 commit comments

Comments
 (0)