Objective-C + CoreData + MySQL = EntityManagerMysql.h
|
This is one of my main private projects I'm currently working on. The goal is to use Apple's CoreData Framework and add MySQL
as a persistent store. The end result is a static library for iPhone or a Cocoa framework for OS X. The current, rather basic
implementation, has almost been finished. Next step is to support NSManagedObjectModel and NSManagedObjectContext to make
this a full blown drop in replacement for Apple's current PersistentStoreType implementations.
|
|
A quick overview of the proposed protocol and interface.
[EntityManager.h]
@protocol EntityManager
- (NSArray *)findAll:(void (^)(struct NSError *))callbackClosure;
- (NSArray *)findByQuery:(NSString *)predicateQuery
withCallback:(void (^)(struct NSError *))callbackClosure;
- (void)printAll:(void (^)(struct NSError *))callbackClosure;
- (void)removeAll:(void (^)(struct NSError *))callbackClosure;
- (void)updateByDictionary:(NSDictionary *)entityByDictionary
withCallback:(void (^)(struct NSError *))callbackClosure;
- (void)removeByDictionary:(NSDictionary *)entityByDictionary
withCallback:(void (^)(struct NSError *))callbackClosure;
- (void)insertByDictionary:(NSDictionary *)entityByDictionary
withCallback:(void (^)(struct NSError *))callbackClosure;
@end
[EntityManagerMysql.h]
@interface EntityManagerMysql : NSObject<EntityManager> {
- (id)initConnectionAtServer:(NSString *)server
withUser:(NSString *)user
withPassword:(NSString *)password
withDatabase:(NSString *)database
withOptionalPort:(int)port;
@end
member since 2009