SQLite: Return number of rows in a SELECT?
BlitzMax Forums/Brucey's Modules/SQLite: Return number of rows in a SELECT?
| ||
Hi guys, This may be a stupid question... but is there a way of -- for example -- doing this: .executeQuery( "SELECT * FROM mytable" ) ...and then calling something that will tell me how many rows are in the result set? I think I'm just overlooking something here, but...! Thanks, Boz. |
| ||
Found this on the SQLite mailing list : > Is there any SQLite C API to find number of rows returned by select > query? In general, determining the number of rows is as difficult a problem as enumerating all rows. There is no magic shortcut. The API to find the number of rows in resultset is sqlite3_step: call it until the resultset is exhausted, count the number of such calls. count(*) aggregate does the same thing internally anyway. For updates you can call the rowsAffected() method. |
| ||
Thanks for the reply Brucey. I'm using SQLite3 for the first time (being used to MySQL) so I guess I ought to RTFM ;) Cheers |
| ||
being used to MySQL They are similar, but as always there are small things which you'll miss in one or the other. I've been considering adding the pretty SQL syntax docs to the module too : http://www.sqlite.org/lang_select.html Which might help getting to grips with the SQL side of it. (rather than having to check out the website all the time). |