develooper Front page | perl.dbi.users | Postings from December 2008

What is the meaning of the "rows" value after a select?

Thread Next
From:
Larry W. Virden
Date:
December 1, 2008 17:29
Subject:
What is the meaning of the "rows" value after a select?
I inherited some perl code that mostly works, but which I've a couple
questions about what it is doing.

Skipping miscellaneous comments, etc. the code sets some variables
from a file, sets its oracle environment, and then does the following:
$oraProdDBH = DBI->connect("dbi:Oracle:", $user_name, $password)
    or die "Failed to connect to $DBI:errstr\n";
$oraProdDBH->{RaiseError} = 1;
$oraProdDBH->{AutoCommit} = 0;
 $oraProdDBH->{LongReadLen}=4000;
$getMatchRec = $oraProdDBH->prepare
(q{
    SELECT sec_person_id, unix_uid FROM csi_core
    WHERE sec_person_id != 0 GROUP BY unix_uid, sec_person_id
    HAVING COUNT(sec_person_id) > 1
});

$getMatchRec->execute()
    or die "Couldn't fetch records from CSI_CORE";

if ($oraProdDBH->rows != 0)
{

and proceeds to do some stuff.

What does that rows member of the oraProdDBH handle represent? When I
print it out, it doesn't appear to be the number of rows selected. In
fact, right now, it has a value of -1.

Is there a meaning for it?  From reading the docs, it seems as if
getting past that die statement should mean that the statement
actually executed (regardless of whether it returned any rows).

The code goes on to use $getMatchRec->fetchrow_array() to get
information and , after that loop finishes, uses $getMatchRec->rows to
determine whether any rows were fetched and processed.

I am just trying to understand what the $oraProdDBH->rows means (if
anything).


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