I have a SELECT query, and I would like to know the number of rows.
I tried:
sqlite3_data_count(statement);
but it always returns 0
SQLite computes the result rows on the fly, so you the number of rows is not known before you have actually read all those rows.
You could execute a separate query SELECT COUNT(*) FROM (original query)
, but this would mean that the query is executed twice.
Instead, you should use a data structure that grows dynamically.