Alfredo Cole <[EMAIL PROTECTED]> wrote:
In order to update a progress bar, I need to know the total number of
rows returned by a query, similar to MySQL's mysql_num_rows. Is there
a function like that in the C API? I may have overlooked it, but have
not found it so far.

There is no such function. Most of the time, SQLite does not know how many rows there are in the resultset until they are all actually retrieved. It just produces rows one by one as it finds them.

The only way I know to achieve what you want is to run the query twice, first as "select count(*)" to obtain the count, then again with the desired column list. Depending on the query, "select count(*)" may take as long as the full query, and in some rare cases it may even be slower. Bottom line, it is impractical to try and produce an accurate progress indicator for SQLite queries.

Igor Tandetnik

Reply via email to