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 as value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.