#import <Foundation/Foundation.h>
@protocol EOCDatabaseConnection
-(void)connect;
-(void)disconnect;
-(BOOL)isConnected;
-(NSArray*)performQuery:(NSString*)query;
@end
/**
* 可以用协议把自己所写的API之中的实现细节隐藏起来,将返回的对象设计为遵从此协议的纯id类型,想要隐藏的类名就不会出现在API中了
*/
@interface EOCDatabaseManager : NSObject
+(id)sharedInstance;
-(id<EOCDatabaseConnection>)connectionWithIdentifier:(NSString *)identifier;
@end
@implementation EOCDatabaseManager
@end
转载于:https://my.oschina.net/u/2319073/blog/630592