Browse Source

Change the use of #if / #endif so that Xcode document items pop over doesn’t get confused. Now when you pull down the document items pop over, all methods are shown.

robertmryan 12 years ago
parent
commit
04f2019a4e
2 changed files with 9 additions and 6 deletions
  1. 3 2
      src/FMDatabasePool.m
  2. 6 4
      src/FMDatabaseQueue.m

+ 3 - 2
src/FMDatabasePool.m

@@ -128,10 +128,11 @@ - (FMDatabase*)db {
         
         //This ensures that the db is opened before returning
 #if SQLITE_VERSION_NUMBER >= 3005000
-        if ([db openWithFlags:_openFlags]) {
+        BOOL success = [db openWithFlags:_openFlags];
 #else
-        if ([db open]) {
+        BOOL success = [db open];
 #endif
+        if (success) {
             if ([_delegate respondsToSelector:@selector(databasePool:shouldAddDatabaseToPool:)] && ![_delegate databasePool:self shouldAddDatabaseToPool:db]) {
                 [db close];
                 db = 0x00;

+ 6 - 4
src/FMDatabaseQueue.m

@@ -54,10 +54,11 @@ - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags {
         FMDBRetain(_db);
         
 #if SQLITE_VERSION_NUMBER >= 3005000
-        if (![_db openWithFlags:openFlags]) {
+        BOOL success = [_db openWithFlags:openFlags];
 #else
-        if (![_db open]) {
+        BOOL success = [_db open];
 #endif
+        if (!success) {
             NSLog(@"Could not create database queue for path %@", aPath);
             FMDBRelease(self);
             return 0x00;
@@ -112,10 +113,11 @@ - (FMDatabase*)database {
         _db = FMDBReturnRetained([FMDatabase databaseWithPath:_path]);
         
 #if SQLITE_VERSION_NUMBER >= 3005000
-        if (![_db openWithFlags:_openFlags]) {
+        BOOL success = [_db openWithFlags:_openFlags];
 #else
-        if (![db open]) {
+        BOOL success = [db open];
 #endif
+        if (!success) {
             NSLog(@"FMDatabaseQueue could not reopen database for path %@", _path);
             FMDBRelease(_db);
             _db  = 0x00;