I did this code to count line numbers in db
int rows = 0; if (sqlite3_open([[SqliteManager getDBPath] UTF8String], &database) == SQLITE_OK) { const char *sql = "select count(*) from artheca"; sqlite3_stmt *countstmt; if(sqlite3_prepare_v2(database, sql, -1, &countstmt, NULL) == SQLITE_OK) { NSLog(@"inside"); rows = sqlite3_column_int(countstmt, 0); } } else sqlite3_close(database); return rows;
But the result is always 0.
So I'm not sure if rows = sqlite3_column_int(countstmt, 0); is the correct statement to get the number of rows ... is this correct?
source share