patch: selectcol_arrayref & MaxRows with multiple columns

Vernon Lyon <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
If selectcol_arrayref is called with MaxRows and multiple Columns, the result is limited not by MaxRows rows but by MaxRows values.

If MaxRows is 100 and you're requesting 2 columns you only get 50 rows!

Patch below:

Index: dbi/DBI.pm
===================================================================
--- dbi/DBI.pm  (revision 13831)
+++ dbi/DBI.pm  (working copy)
@@ -1655,7 +1655,7 @@
        }
        my @col;
        if (my $max = $attr->{MaxRows}) {
-           push @col, @values while @col<$max && $sth->fetch;
+           push @col, @values while 0 < $max-- && $sth->fetch;
        }
        else {
            push @col, @values while $sth->fetch;

 		 	   		  
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.