This is the code:
NSArray *)getFirstClassifications
{
sqlite3 *database;
NSMutableArray *result = [[NSMutableArray alloc] init];
if(sqlite3_open([databasePath UTF8String], &database)== SQLITE_OK) {
const char *sqlStatement;
if([[self getCurrentLanguage] isEqualToString:@"it-IT"] || [[self getCurrentLanguage] isEqualToString:@"it"])
{
sqlStatement = "select a.id, title_it, flag_new, promo_list, path, type from firstclassifications a left join images b on a.images_id_it=b.id ";
}
else
{
sqlStatement = "select a.id, title_en, flag_new, promo_list, path, type from firstclassifications a left join images b on a.images_id_en=b.id ";
}
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
NSInteger uid = sqlite3_column_int(compiledStatement, 0);
NSString *titleIt = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
BOOL flagNew = sqlite3_column_int(compiledStatement, 2);
NSString *promoList = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
NSString *imagePath =[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)];
NSString *imageFullPath = [NSString stringWithFormat:@"ipad_img_1/%@",imagePath];
FirstClassification *fc = [[FirstClassification alloc] initWithParams:uid titleIt:titleIt flagNew:flagNew promoList:promoList imagePath:imageFullPath];
[result addObject:fc];
}
}
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
return result;
}
The error message is shown at the line 9 and the error message shown is:"EXC_BAD_ACCESS".
The object database show this log:" (sqlite3 *) database = <register x1 is not available>"