Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Counting rows Sqlite

by ikegami (Patriarch)
on May 08, 2010 at 22:01 UTC ( [id://839067]=note: print w/replies, xml ) Need Help??


in reply to Counting rows Sqlite

selectall_arrayref returns a reference to an array of rows.
my $all = $dbh->selectall_arrayref(" SELECT ID, col1, col2 FROM table WHERE col1 = 'xxx' "); print "Number of rows selected: ", 0+@$all, "\n";
or if you don't actually need the rows:
my ($count) = $dbh->selectrow_array(" SELECT COUNT(*) FROM table WHERE col1 = 'xxx' "); print "Number of rows selected: $count\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-18 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found