所以我得到了这个错误:准备失败'失去记忆'。有谁知道为什么会这样?注意我测试了我的sql语句。它很棒。另外,我正在检查在另一个方法中打开数据库。它打开就好了。任何帮助,将不胜感激。谢谢!
+(NSArray *) fetchListForFirstLEvelCategory
{
NSMutableArray * array = [[NSMutableArray alloc]init];
NSString * query;
query = [NSString stringWithFormat:@"select mobile_menu.title from sup_pick join sup_mast as mobile_menu on mobile_menu.custom_link1 = sup_pick.key_id and mobile_menu.show_id = '1D2EA159-A312-4FB5-8FE5-B95879B242BB' and mobile_menu.type = 996 and mobile_menu.active = 1 and mobile_menu.status = 1 where sup_pick.client_id = '2517EFF6-8063-4454-BA5F-23679F51AD5A' and sup_pick.active = 1 and sup_pick.parent_key = 'CB18E277-23E9-4232-A20C-AD4D051C578B' and sup_pick.field_name like '%%0000' Order by sup_pick.field_name,mobile_menu.display_order"];
const char *query_stmt = [query UTF8String];
sqlite3_stmt * sql;
if (sqlite3_prepare_v2(db, query_stmt, -1, &sql, NULL) == SQLITE_OK)
{
while (sqlite3_step(sql)==SQLITE_ROW)
{
NSString* test= [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 0)];
[array addObject:test];
}
return array;
}
NSLog(@"%s Prepare failure '%s' (%1d)", __FUNCTION__, sqlite3_errmsg(db), sqlite3_errcode(db));
return nil;
}
+(NSArray *) fetchListForFirstLEvelCategory
{
NSMutableArray * array = [[NSMutableArray alloc]init];
NSString * query;
query = [NSString stringWithFormat:@"select mobile_menu.title from sup_pick join sup_mast as mobile_menu on mobile_menu.custom_link1 = sup_pick.key_id and mobile_menu.show_id = '1D2EA159-A312-4FB5-8FE5-B95879B242BB' and mobile_menu.type = 996 and mobile_menu.active = 1 and mobile_menu.status = 1 where sup_pick.client_id = '2517EFF6-8063-4454-BA5F-23679F51AD5A' and sup_pick.active = 1 and sup_pick.parent_key = 'CB18E277-23E9-4232-A20C-AD4D051C578B' and sup_pick.field_name like '%%0000' Order by sup_pick.field_name,mobile_menu.display_order"];
const char *query_stmt = [query UTF8String];
sqlite3_stmt * sql;
if (sqlite3_prepare_v2(db, query_stmt, -1, &sql, NULL) == SQLITE_OK)
{
while (sqlite3_step(sql)==SQLITE_ROW)
{
NSString* test= [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 0)];
[array addObject:test];
}
return array;
}
NSLog(@"%s Prepare failure '%s' (%1d)", __FUNCTION__, sqlite3_errmsg(db), sqlite3_errcode(db));
return nil;
}