"Tom Parke" <[EMAIL PROTECTED]> wrote: > If I prepare() a sql stmt SELECT * FROM tbl WHERE col = n: > > How do I find out how many records were selected before calling step()? >
The technically correct response to your question is that the answer is always zero. Nothing gets selected - the database file remains unread - until you call sqlite3_step(). But that probably is not what you were asking, huh. :-) If you want to find out how many records would be selected by such a query, you can do: SELECT count(*) FROM tbl WHERE col=n; Or you can do: cnt = 1; while( sqlite3_step(&stmt)==SQLITE_ROW ) cnt++; There is no way for the database engine to determine how many records are going to match your search condition without actually doing the search and counting the hits. -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------