Hello List,
could someone with a working DBD::Oracle 1.28 please verify that the
tests 2 and 4 in the attached test script fail?
All test pass with DBD::Oracle 1.23, tests 2 and 4 fail with DBD::Oracle
1.27.
Background information: I use Perl to provide access to an ancient
legacy system, that system sends strings to a Perl server, the server
invokes DBI methods and passes those strings as parameters. The call to
$sth->bind_col() worked fine with DBD::Oracle 1.23, it crashes with
"Invalid column number" on DBD::Oracle 1.27. I think DBD::Oracle broke
somewhere between 1.23 and 1.27.
In dbdim.c of DBD::Oracle 1.27, dbd_st_bind_col() tests SvIOK(col), but
makes no attempts to convert col to a number first. Older versions seem
to use a default implementation of bind_col provided by DBI in DBI.xs.
In that file, dbih_sth_bind_col() fetches the column number by calling
SvIV(col).
Thanks,
Alexander
#!/usr/bin/perl
use warnings;
use strict;
use Test::More tests => 4;
use DBI;
my $dbh=DBI->connect(
'dbi:Oracle:host=lue-abteilung-1;sid=ALFO',
'scott',
'tiger', {
RaiseError => 1,
PrintError => 0,
}
);
diag("DBD::Oracle version ",$DBD::Oracle::VERSION);
my $dummy;
ok(
eval {
my $sth=$dbh->prepare('select dummy from dual');
$sth->execute();
$sth->bind_col(1,\$dummy);
$sth->finish();
1;
},
'bind_col(1,\$dummy) runs'
);
ok(
eval {
my $sth=$dbh->prepare('select dummy from dual');
$sth->execute();
$sth->bind_col('1',\$dummy);
$sth->finish();
1;
},
'bind_col("1",\$dummy) runs'
);
ok(
eval {
my $n=1;
my $sth=$dbh->prepare('select dummy from dual');
$sth->execute();
$sth->bind_col($n,\$dummy);
$sth->finish();
1;
},
'bind_col($n=1,\$dummy) runs'
);
ok(
eval {
my $n='1';
my $sth=$dbh->prepare('select dummy from dual');
$sth->execute();
$sth->bind_col($n,\$dummy);
$sth->finish();
1;
},
'bind_col($n="1",\$dummy) runs'
);
$dbh->disconnect();