develooper Front page | perl.dbi.users | Postings from February 2005

RE: parameter binding issues with DBD::Oracle

Thread Previous | Thread Next
From:
campbelb
Date:
February 1, 2005 08:27
Subject:
RE: parameter binding issues with DBD::Oracle
Message ID:
17D8724A2A8D9542B2B8AE546B9E5BBC03A934C6@az4315exch001u.phx.lucent.com
FYI,

For some drivers, "rows" may not return the correct value even after all the rows have been fetched.  If I may quote Michael Peppler with regards to Sybase in an email he sent me.  This is in regard to the "rows" method after a call to fetchall_arrayref...

Relying on $sth->rows() is a little iffy. In the case of DBD::Sybase it returns -1 (that may be a bug, I'll look into it). You should probably simply use the number of elements in the [returned arrays] to determine the number of rows returned.


-----Original Message-----
From: jdw@ou.edu [mailto:jdw@ou.edu] 
Sent: Monday, January 31, 2005 4:21 PM
To: Juan Jose Natera
Cc: DBI Users
Subject: Re: parameter binding issues with DBD::Oracle

Juan,

The problem is your usage of "$sth->rows".  You aren't
guaranteed to know how many rows are available before
you read them, so your example doesn't really show whether
data was available or not.  Here is a snip from "perldoc DBI":

...

         For select statements it is generally not possible to
         know how many rows will be returned except by fetching
         them all.  Some drivers will return the number of rows
         the application has fetched so far but others may return
         -1 until all rows have been fetched. So use of the rows
         method with select statements is not recommended.

Juan Jose Natera wrote:


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About