EGODatabase does not retain inserted record
- by user135775
Hi Guy!
I'm using EGODatabase to process my data. When I tried to insert data into the database which I created with Base and attached to the project, the data that was inserted programmatically will not show up when I restart my app.However the data inserted manually using Base will show up just fine.
Following is the code for inserting data into the database:
NSString *path = [[NSBundle mainBundle] pathForResource:@"Database" ofType:@"db"];
db = [EGODatabase databaseWithPath:path];
if ([db open]) {
NSLog(@"Database is opened successfully!");
} else {
NSLog(@"Database is failed to open!");
}
NSArray *params = [NSArray arrayWithObjects:[aFeed feedID], [aFeed title], nil];
[db executeUpdate:@"Insert INTO Feed (FeedID, Title) VALUES (?, ?)" parameters:params];
EGODatabaseResult *results = [db executeQuery:@"SELECT * FROM Feed"];
for ( EGODatabaseRow * row in results) {
NSLog(@"ID: %@ Title: %@", [row stringForColumn:@"FeedID"], [row stringForColumn:@"Title"]);
}
I appreciate if anyone can share me a working sample code for EGODatabase. I'm using EGODatabase because I might have multi-threading code that write to the database.
Thank in advance.