FMDatabaseQueue.h 1023 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // FMDatabaseQueue.h
  3. // fmdb
  4. //
  5. // Created by August Mueller on 6/22/11.
  6. // Copyright 2011 Flying Meat Inc. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "sqlite3.h"
  10. @class FMDatabase;
  11. @interface FMDatabaseQueue : NSObject {
  12. NSString *_path;
  13. dispatch_queue_t _queue;
  14. FMDatabase *_db;
  15. }
  16. @property (atomic, retain) NSString *path;
  17. + (id)databaseQueueWithPath:(NSString*)aPath;
  18. - (id)initWithPath:(NSString*)aPath;
  19. - (void)close;
  20. - (void)inDatabase:(void (^)(FMDatabase *db))block;
  21. - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block;
  22. - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block;
  23. #if SQLITE_VERSION_NUMBER >= 3007000
  24. // NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock.
  25. // If you need to nest, use FMDatabase's startSavePointWithName:error: instead.
  26. - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block;
  27. #endif
  28. @end