Skip to content

Commit

Permalink
Merge pull request ccgus#220 from robertmryan/master
Browse files Browse the repository at this point in the history
Change the use of #if / #endif
  • Loading branch information
ccgus committed Jan 13, 2014
2 parents 9d989cc + 04f2019 commit 395f7b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/FMDatabasePool.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/FMDatabaseQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 395f7b7

Please sign in to comment.