FMDB SQLite question: row count of a query?

前端 未结 8 2050
别那么骄傲
别那么骄傲 2021-02-01 17:41

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

8条回答
  •  佛祖请我去吃肉
    2021-02-01 18:31

    Shorter code to accomplish the same thing:

    NSUInteger count = [db intForQuery:@"SELECT COUNT(field) FROM table_name"];

    Make sure to include the FMDatabaseAdditions.h header file to use intForQuery:.

提交回复
热议问题