On Sep 14, 2010, at 3:25 AM, m p wrote:
> So : is it possible to get the numbers of rows returned by a query using the
> mysqlpp::UseQueryResult object ?
> (Without obviously looking through all tuples)
Not without making the database server do a second table scan ahead of the "use" query.
The least inefficient way to ask it to do that is to use the COUNT function:
e.g. SELECT COUNT(*) FROM my_table WHERE some_col=value;
That will tell you how many rows in my_table have the given some_col value. Beware that
if the table is changed between the COUNT query and "real" query, the count can be off.
It may be possible to guarantee an accurate count by wrapping both queries in a
transaction, but I couldn't say for sure.
> And is it maybe possible to seek back in the query results ?
No. MySQL limitation.