NSObject+LKDBHelper.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // NSObject+LKDBHelper.h
  3. // LKDBHelper
  4. //
  5. // Created by upin on 13-6-8.
  6. // Copyright (c) 2013年 ljh. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "LKDBHelper.h"
  10. @class LKDBHelper;
  11. @interface NSObject(LKDBHelper)
  12. //callback delegate
  13. +(void)dbDidCreateTable:(LKDBHelper*)helper;
  14. +(void)dbWillInsert:(NSObject*)entity;
  15. +(void)dbDidInserted:(NSObject*)entity result:(BOOL)result;
  16. +(void)dbWillUpdate:(NSObject*)entity;
  17. +(void)dbDidUpdated:(NSObject*)entity result:(BOOL)result;
  18. +(void)dbWillDelete:(NSObject*)entity;
  19. +(void)dbDidIDeleted:(NSObject*)entity result:(BOOL)result;
  20. //only simplify synchronous function
  21. +(int)rowCountWithWhere:(id)where;
  22. +(NSMutableArray*)searchWithWhere:(id)where orderBy:(NSString*)orderBy offset:(int)offset count:(int)count;
  23. +(id)searchSingleWithWhere:(id)where orderBy:(NSString*)orderBy;
  24. +(BOOL)insertToDB:(NSObject*)model;
  25. +(BOOL)insertWhenNotExists:(NSObject*)model;
  26. +(BOOL)updateToDB:(NSObject *)model where:(id)where;
  27. +(BOOL)updateToDBWithSet:(NSString*)sets where:(id)where;
  28. +(BOOL)deleteToDB:(NSObject*)model;
  29. +(BOOL)deleteWithWhere:(id)where;
  30. +(BOOL)isExistsWithModel:(NSObject*)model;
  31. - (void)saveToDB;
  32. - (void)deleteToDB;
  33. @end