First, thanks to everyone for their input on this. It has resulted in a much 
bigger discussion than I had assumed would happen...

I obviously have a fundamental misunderstanding of how SQLite processes a 
request, (I'll read the link that Hick gave me - thanks for that).

So to answer my original question: there isn't an api that gives this value ** 
because ** SQLite doesn't build the full answer set before returning from that 
first sqlite3_step function call.

I'll do some reading and come back with any further questions

Cheers,
Dave


Ward Analytics Ltd - information in motion
Tel: +44 (0) 118 9740191
Fax: +44 (0) 118 9740192
www: http://www.ward-analytics.com

Registered office address: The Oriel, Sydenham Road, Guildford, Surrey, United 
Kingdom, GU1 3SR
Registered company number: 3917021 Registered in England and Wales.


-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Richard Hipp
Sent: 18 September 2017 10:03
To: SQLite mailing list
Subject: Re: [sqlite] [EXTERNAL] Number of rows in answer set

On 9/18/17, David Wellman <dwell...@ward-analytics.com> wrote:
> sqlite3_step - this one runs the sql, builds an answer set and then returns
> the first row

No.  sqlite3_step() does not "build the answer set".  It only begins
computing the answer, stopping at the first row.  The sqlite3_step()
routine has no idea how many more rows will follow at that point.

The only way to find out how many rows there are in the answer set is
to run sqlite3_step() repeatedly and count the number of times it
returns SQLITE_ROW before returning SQLITE_DONE.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to