Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 72432
Status: new
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: smosin [...] mail.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: bind_param for ORA_..._TABLE use previous size of array if it is empty
Download (untitled) / with headers
text/plain 1.4k
Hello, if we use $sql->bind_param(':arr', \@arr, {ora_type => ORA_VARCHAR2_TABLE, ora_maxarray_numentries => 0}); when @arr is empty the call will use the size of the previous call when the array wasn't empy Test case follows ===== use strict; use warnings; use DBI; use DBD::Oracle qw/:ora_types/; my ($connect_string, $user, $password) = ('ai', 'scott', 'tiger'); my @arr; my $sql; # SQL statements # Connect my $dbh = DBI->connect('DBI:Oracle:' . $connect_string, $user, $password , {RaiseError =>1, PrintWarn => 1}) or die 'Can\'t connect'; sub printArr { while (my $l = $dbh->func( 'dbms_output_get' ) ) { print STDOUT $l, "\n"; } print STDOUT "\n\n"; } $dbh->do(<<EOF); # Create Procedure Create or Replace procedure test_arr(a in SYS.DBMS_SQL.VARCHAR2_TABLE) as BEGIN for L in a.first .. a.last loop dbms_output.put_line(L || '->' || a(L)); end loop; dbms_output.new_line; dbms_output.new_line; END; EOF ; $sql = $dbh->prepare('begin test_arr(:arr); end;'); $dbh->func( 1000000, 'dbms_output_enable' ); for my $t ( [1,2,3,4,5], [6,7,8], [], [11,12,13,14,15]) { my @arr = (@$t); $sql->bind_param(':arr', \@arr, {ora_type => ORA_VARCHAR2_TABLE, ora_maxarray_numentries => 0}); $sql->execute; printArr; } ===== I have the following output of the test run ====== 1->1 2->2 3->3 4->4 5->5 1->6 2->7 3->8 1-> 2-> 3-> 1->11 2->12 3->13 4->14 5->15 === I've attached file with test case. Regards, Sergey
Subject: test_arr.pl
Download test_arr.pl
text/x-perl 1.1k
# Sergey Mosin smosin @ mail . ru use strict; use warnings; use DBI; use DBD::Oracle qw/:ora_types/; my ($connect_string, $user, $password) = ('ai', 'scott', 'tiger'); my @arr; my $sql; # SQL statements # Connect my $dbh = DBI->connect('DBI:Oracle:' . $connect_string, $user, $password , {RaiseError =>1, PrintWarn => 1}) or die 'Can\'t connect'; sub printArr { while (my $l = $dbh->func( 'dbms_output_get' ) ) { print STDOUT $l, "\n"; } print STDOUT "\n\n"; } $dbh->do(<<EOF); # Create Procedure Create or Replace procedure test_arr(a in SYS.DBMS_SQL.VARCHAR2_TABLE) as BEGIN for L in a.first .. a.last loop dbms_output.put_line(L || '->' || a(L)); end loop; dbms_output.new_line; dbms_output.new_line; END; EOF ; $sql = $dbh->prepare('begin test_arr(:arr); end;'); $dbh->func( 1000000, 'dbms_output_enable' ); for my $t ( [1,2,3,4,5], [6,7,8], [], [11,12,13,14,15]) { my @arr = (@$t); $sql->bind_param(':arr', \@arr, {ora_type => ORA_VARCHAR2_TABLE, ora_maxarray_numentries => 0}); $sql->execute; printArr; }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.