RE: anyway to determine # rows before fetch loop ends and without seperate count(*)
am 16.11.2005 23:49:00 von Will.Rutherdale------_=_NextPart_001_01C5EAFF.4B43FC49
Content-Type: text/plain
It doesn't work according to the DBI documentation.
From _Programming the Perl DBI_, p. 223 (for example):
>For SELECT statements, execute simply "starts" the query within the
database engine. Use one of
>the fetch methods to retrieve the data after calling execute. The execute
method does _not_ return
>the number of rows that will be returned by the query (because most
databases can't tell in advance),
>it simply returns a true value.
If you are relying on that 'feature' you are asking for trouble.
There have been discussions over this issue on the list before.
-Will
-----Original Message-----
From: Rob Craig [mailto:rcraig@beavisinformatics.ca]
Sent: Wednesday 16 November 2005 17:19
To: listmail@triad.rr.com
Cc: dbi-users@perl.org
Subject: Re: anyway to determine # rows before fetch loop ends and without
seperate count(*)
I am using DBD::mysql and I can get the number of rows by assigning the
result of the execute to a scalar:
my $rows = $sth->execute or die "Couldn't execute statement: " .
DBI->errstr;
maybe this doesn't work with DBD::Oracle?
Rob
- - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - -
This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
------_=_NextPart_001_01C5EAFF.4B43FC49--