我想在下面询问我的功能。当我调用此函数时,它会打印 NOT AVAILABLE。请问你能帮帮我吗??
static sqlite3 *database = nil;
static sqlite3_stmt *statement = nil;
- (BOOL) findNews:(NSString *)caption{
const char *dbpath = [databasePath UTF8String];
if (sqlite3_open(dbpath, &database) == SQLITE_OK)
{
NSLog(@"CAPTION ID : %@", caption);
NSString *querySQL = [NSString stringWithFormat:@"SELECT * FROM dbase WHERE CONTENT_ID = \"%@\"", caption];
const char *query_stmt = [querySQL UTF8String];
if (sqlite3_prepare_v2(database, query_stmt, -1, &statement, NULL) == SQLITE_OK)
{
if (sqlite3_step(statement) == SQLITE_ROW)
{
return YES;
}
else{
return NO;
}
sqlite3_reset(statement);
}else{
NSLog(@"NOT AVAILABLE");
}
}
return nil;
}