On 25.03.2011 12:16, Martin J. Evans wrote:
On 25/03/11 11:06, Martin J. Evans wrote:
On 24/03/11 15:26, Alexander Foken wrote:
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

1..4
# DBD::Oracle version 1.28
ok 1 - bind_col(1,\$dummy) runs
not ok 2 - bind_col("1",\$dummy) runs
# Failed test 'bind_col("1",\$dummy) runs'
# at /home/martin/bind_col_str.pl line 32.
ok 3 - bind_col($n=1,\$dummy) runs
not ok 4 - bind_col($n="1",\$dummy) runs
# Failed test 'bind_col($n="1",\$dummy) runs'
# at /home/martin/bind_col_str.pl line 55.
# Looks like you failed 2 tests of 4.

Martin

This bug was probably my fault as I added bind_col to DBD::Oracle. Thanks for spotting it Alexander. It will be fixed in trunk later today and as you rightly identified is fixed by simply removing that check:

    if (!SvIOK(col)) {
        croak ("Invalid column number") ;
    }

Martin

Removing that three lines makes all my tests pass in DBD::Oracle 1.28. Had no time today to check older versions.

Alexander


--
Alexander Foken
mailto:alexan...@foken.de  http://www.foken.de/alexander/

Reply via email to