If you only need to get the table size,
musql_affected_row is the function to call,
i'm not sure of the function name under the perl
APi,
But you may need more, I got exactly that problem when trying to select a
few items
from a database while displaying only a few of them
(take as example google and the pages system)
It happens basically you select items using a MAX option
(saying that you want only MAX items, and a starting item options
(something like LIMIT 10 30 output up to 30 rows starting from row 10),
note that in such cases the order
is relevant.
In this case some databases allow you to access the total number
of selected items before the conditionnal
on the maxnumber (and starting item)
As example with Mysql 4 some function (select found_rows()) return this
number (which is different from the number of rows in the table that you
get).
mysql_affected_rows returns the size of the table that you get,
or the number of rows affected by an update, delete or anything.
Note that if you use a count(*) you will get troubles
if you also use a "group by" modifier,
Select count(*) from Student, Class where Student.ID=Class.StudentID
and Class.Name like "Maths%" group by Student.ID
will return a table where for each sutdent we find the number of
Maths courses she/he attempts (Eg if we have Maths1 and Maths2 etc ..)
and not the total number of row in the resulting table.