テーブルとデータベースに同じ名前を付けましたが、そのようなテーブルが見つからないというエラーが発生しています。
sqlite3 *dbConnection = nil;
NSArray *documentDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [documentDirectory objectAtIndex:0];
NSString *documentPath = [path stringByAppendingPathComponent:@"locations.sqlite"];
sqlite3_open([documentPath UTF8String], &dbConnection);
sqlite3_stmt *statement = nil;
@try {
if(sqlite3_open([documentPath UTF8String], &dbConnection)!=SQLITE_OK)
{
sqlite3_close(dbConnection);
}
else
{
//create editable database copy
}
NSString *selectQuery=[[NSString alloc] initWithFormat:@"select * from address_locations"];
const char * retrieveQuery = [selectQuery UTF8String];
if(sqlite3_prepare_v2(dbConnection,retrieveQuery, -1, &statement, nil)==SQLITE_OK)
{
while (sqlite3_step(statement)==SQLITE_ROW)
{
NSMutableDictionary * dictionaryAboutInfo = [[NSMutableDictionary alloc]init];
[dictionaryAboutInfo setValue:[NSString stringWithFormat:@"%s",sqlite3_column_text(statement, 0)] forKey:@"ZIP"];
[dictionaryAboutInfo setValue:[NSString stringWithFormat:@"%s",sqlite3_column_text(statement, 1)] forKey:@"LATITUDE"];
[dictionaryAboutInfo setValue:[NSString stringWithFormat:@"%s",sqlite3_column_text(statement, 2)] forKey:@"LONGITUDE"];
////NSLog(@"Retrived Dict values %@",dictionaryAboutInfo);
[dealersInfoArray addObject:dictionaryAboutInfo];
[dictionaryAboutInfo release];
}
}
[selectQuery release];
}
@catch (NSException *exception) {
}
@finally {
sqlite3_finalize(statement);
sqlite3_close(dbConnection);
}
前もってありがとう