-
EGODatabase, SQLite made easy on iPhone
Lots of people complain about how hard SQLite and CoreData is to use on the iPhone SDK. So I set out to find something a bit easier and interesting to use. What I came across is @enormego’s EGODatabase.
This is how simple things become after using EGODatabase -EGODatabase* database = [EGODatabase databaseWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/database.db"]];
EGODatabaseResult* result = [database executeQuery:@"SELECT * FROM `posts` WHERE `post_user_id` = ?", [NSNumber numberWithInt:10]];
for(EGODatabaseRow* row in result) {
NSLog(@"Subject: %@", [row stringForColumn:@"post_subject"]);
NSLog(@"Date: %@", [row dateForColumn:@"post_date"]);
NSLog(@"Views: %d", [row intForColumn:@"post_views"]);
NSLog(@"Message: %@", [row stringForColumn:@"post_message"]);
}
Happy coding!