Skip Menu |

This queue is for tickets about the DBD-ODBC CPAN distribution.

Report information
The Basics
Id: 79397
Status: resolved
Priority: 0/
Queue: DBD-ODBC

People
Owner: Nobody in particular
Requestors: bohica [...] ntlworld.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.39
Fixed in: 1.40_1



Subject: output bound parameters may be incorrectly bound if changed after bind_param_inout
This issue is in 1.39 and probably most versions of DBD::ODBC back to when deferred binding was removed (and it was only for MS SQL Server anyway). It cropped up on perl monks at http://perlmonks.org/?node_id=989136. The following code fails. Output expected and actual output below: my $dbh = DBI->connect; my @cols = qw(foo bar); my $sql = <<SQL; SELECT :foo, :bar SQL my $sth = $dbh->prepare($sql); my %hsh; for (@cols) { $sth->bind_param_inout( "$_" => \$hsh{$_}, 0 ); } Dump($hsh{foo}); # Set constants... #Dump($hsh{foo}); $hsh{foo} = 'abc'; #$hsh{foo} .= "aaa"; # Set changing values #Dump($hsh{bar}); $hsh{bar} = 123; #Dump($hsh{bar}); Dump($hsh{foo}); $sth->execute(); while (my @arr = $sth->fetchrow_array) { print "@arr\n"; } $hsh{bar} = 456; $sth->execute(); while (my @arr = $sth->fetchrow_array) { print "@arr\n"; } $dbh->disconnect(); Actual output: Use of uninitialized value $arr[0] in join or string at /tmp/x.pl line 33. 123 Use of uninitialized value $arr[0] in join or string at /tmp/x.pl line 39. 456 Expected output: abc 123 abc 456 Martin -- Martin J. Evans Wetherby, UK