Name
sqlCount — returns the number of rows in a table
Synopsis
my $rows = $slashdb->sqlCount($table); my $rows = $slashdb->sqlCount($table, $where);
sqlCount
is a simple function that counts the number of
rows in a table or tables. The $table
parameter is a string
containing the name of a table or a comma-separated list of unique table names
from which to count the rows. (If multiple tables are selected, the returned
value will be the Cartesian product of the number of rows from each table, not
the sum of the number of rows.) The $where
parameter is
optional. If provided, the keyword WHERE
will be prepended, and
the resulting clause will be added as a WHERE
clause to the SQL statement.
Example
my $users = $slashdb->sqlCount('users'); print "$users active users on the system.\n";
Get Running Weblogs with Slash now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.