Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: DBI::rows

by Maestro_007 (Hermit)
on Jun 29, 2001 at 01:16 UTC ( [id://92472]=note: print w/replies, xml ) Need Help??


in reply to DBI::rows

I agree that if you can, SELECT COUNT(name) WHERE ... works best. Also, depending on whether or not the NAME column is a primary key or otherwise unique value, you may want SELECT COUNT (DISTINCT name) WHERE ... to get a count of all the guaranteed unique names. But if for some reason you can't or you don't want to, you can use this snippet after your original query:
my $rows = $sth->fetchall_arrayref() my $num_rows = scalar (@$rows);
It will return a reference to an AoA (Array of Arrays). The scalar is optional, of course. You can then use the data in $rows for actual manipulation, if the need arises...

MM

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://92472]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-22 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found