does anyone know how to return the count of a query when using FMDB? If I executeQuery @\"select count(*) from sometable were...\" I get an empty FMResultSet back. How can I get
The first one is also right but by using this method you can retrieve records and count using the same query , no headache to write another one. Just add count(*) as count to your query.
You could always just run the proper SQL statement. I do something like:
FMResultSet *rs = [database executeQuery:@"select count(*) as count from words"];
[rs next];
wordsThatExist = [rs intForColumn:@"count"];
Setting up the SQL query may be quicker and cheaper then iterating.. I believe counts are cheap.