File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,6 +189,9 @@ typedef NS_ENUM(NSInteger, FCModelChangeType) {
189189+ (void )performTransaction : (BOOL (^)(void ))block ; // return YES to commit, NO to roll back
190190+ (BOOL )isInTransaction ;
191191
192+ // This variant has no control over commit/rollback; safe to potentially nest inside other transactions if you only want performance
193+ + (void )performInTransactionForPerformance : (void (^)(void ))block ;
194+
192195// Field info: You probably won't need this most of the time, but it's nice to have sometimes. FCModel's generating this privately
193196// anyway, so you might as well have read-only access to it if it can help you avoid some code. (I've already needed it.)
194197//
Original file line number Diff line number Diff line change @@ -1117,6 +1117,14 @@ + (BOOL)isInTransaction
11171117 return inTransaction;
11181118}
11191119
1120+ + (void )performInTransactionForPerformance : (void (^)(void ))block
1121+ {
1122+ [self inDatabaseSync: ^(FMDatabase *db) {
1123+ if (db.inTransaction ) block ();
1124+ else [self performTransaction: ^BOOL { block (); return YES ; }];
1125+ }];
1126+ }
1127+
11201128+ (void )performTransaction : (BOOL (^)(void ))block
11211129{
11221130 __block NSDictionary *changedFieldsToNotify = nil ;
You can’t perform that action at this time.
0 commit comments