Are you using SQLite from within an application?  Here are some things I do:
1. Put query results into an array and get the count of items in the array.
2. For some tables, store the record count of the table into another table. 
Then just read that value when you need it. I use triggers to help me keep all 
the quantities updated.

Greg Moore
thewatchful...@gmail.com

> On Sep 18, 2017, at 3:37 AM, Hick Gunter <h...@scigames.at> wrote:
> 
> SQLite uses some nifty heuristics to estimate the number of rows it expects 
> to process while formulating a query plan. The only way to come up with the 
> exact number of result rows is to actually run the query. At which point you 
> already know how many rows have been returned.
> 
> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
> Auftrag von David Wellman
> Gesendet: Montag, 18. September 2017 10:27
> An: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org>
> Betreff: [EXTERNAL] [sqlite] Number of rows in answer set
> 
> Hi,
> 
> If I run a SELECT statement that returns an answer set is there an api call 
> that will tell me "number of rows in answer set" - something like 
> "sqlite3_row_count"? I have looked at the calls but couldn't find any - sorry 
> if I've missed it.
> 
> 
> 
> I know could use a "create temporary table xxx as my-select" and then "select 
> count(*) from xxx" but was wondering if SQLite holds that information in an 
> accessible place.
> 
> 
> 
> Cheers,
> 
> Dave
> 
> 
> 
> Ward Analytics Ltd - information in motion
> 
> Tel: +44 (0) 118 9740191
> 
> Fax: +44 (0) 118 9740192
> 
> www:  <http://www.ward-analytics.com> 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.
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> ___________________________________________
> Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: h...@scigames.at
> 
> This communication (including any attachments) is intended for the use of the 
> intended recipient(s) only and may contain information that is confidential, 
> privileged or legally protected. Any unauthorized use or dissemination of 
> this communication is strictly prohibited. If you have received this 
> communication in error, please immediately notify the sender by return e-mail 
> message and delete all copies of the original communication. Thank you for 
> your cooperation.
> 
> 
> _______________________________________________
> 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