Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBI::rows

by Maestro_007 (Hermit)
on Jun 29, 2001 at 01:16 UTC ( #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? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2023-02-05 14:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?