SELECT count(*) from BOOKS where BOOKS.TAG_ID like '%,1,%'
我想在 Objective-C 中执行这个查询。
const char *sql = "Select count(*) from Documents WHERE DocumentTag LIKE '%i,?,%i'";
sqlite3_stmt *sqlStatement;
NSString *bindParam = [NSString stringWithFormat:@"%d", tagId];
if(sqlite3_bind_int(sqlStatement, 1, tagId)!= SQLITE_OK){
NSLog(@"Problem binding search text param.");
}
else if(sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL)==SQLITE_OK)
{
sqlite3_bind_int(sqlStatement, 1, sqlite3_column_int(sqlStatement, 0));
if(sqlite3_step(sqlStatement)==SQLITE_ROW)
taskCount=sqlite3_column_int(sqlStatement,0);
sqlite3_reset(sqlStatement);
sqlite3_finalize(sqlStatement);
}