i want to access data fetched in DBhelper class from database in UIViewcontroller class, i have imported class,created object, methods and all variable are accessible in UIViewcontroller class. when methods are called through uiviewcontroller class they are showing database results or whatever methods are assigned to do but when in use those variables/arrays in uiviewcontroller by objects they return null.even i have implemented prperties and synthesised them too.. here is my code
-(NSMutableArray *) SaveDBInArray {
[self createEditableCopyOfDatabaseIfNeeded];
[self initializeDatabase];
const char *sql = "SELECT * FROM table11";
if (sqlite3_prepare_v2(database, sql, -1, &init_statement, NULL) != SQLITE_OK) {
//NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database)); }
while (sqlite3_step(init_statement) == SQLITE_ROW) {
colum1= [NSString stringWithUTF8String:(char *)sqlite3_column_text(init_statement,0)];
colum2= [NSString stringWithUTF8String:(char *)sqlite3_column_text(init_statement,1)];
allEnteries=[[NSMutableArray alloc]init];
[allEnteries addObject:colum1];
[allEnteries addObject:colum2];
}
NSLog(@"array with values %@",allEnteries );
//HERE WHENEVER METHOD IS BEING CALLED IT IS DISPLAYING ONLY TOP ONE VALUE FROM EACH COLUM BUT I WANT ALL OF THEM
sqlite3_reset(init_statement);
[self closeDatabase];
return allEnteries;
}