diff options
author | August "Gus" Mueller <gus@flyingmeat.com> | 2013-12-10 22:00:45 +0400 |
---|---|---|
committer | August "Gus" Mueller <gus@flyingmeat.com> | 2013-12-10 22:00:45 +0400 |
commit | 4250e032274705cf50cf82dbd59ac255a8aa88b9 (patch) | |
tree | 152a50958bc3c2de4ef3ff7ca4ebc10376b9c069 | |
parent | 4ef996a6221412e9551b80dcf1e32ae1c6edc980 (diff) | |
parent | a1eb7305f80bf43f8e21bc08f1c24800d9a436dc (diff) |
Merge pull request #213 from 5at5ish/master
Fix for issue #203: Add 'databaseClass' class method for FMDatabaseQueue.
-rw-r--r-- | src/FMDatabaseQueue.h | 9 | ||||
-rw-r--r-- | src/FMDatabaseQueue.m | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/FMDatabaseQueue.h b/src/FMDatabaseQueue.h index 59c197e..daf6520 100644 --- a/src/FMDatabaseQueue.h +++ b/src/FMDatabaseQueue.h @@ -112,6 +112,15 @@ - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; +/** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object. + + Subclasses can override this method to return specified Class of 'FMDatabase' subclass. + + @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object. + */ + ++ (Class)databaseClass; + /** Close database used by queue. */ - (void)close; diff --git a/src/FMDatabaseQueue.m b/src/FMDatabaseQueue.m index 9b4a564..01b9e26 100644 --- a/src/FMDatabaseQueue.m +++ b/src/FMDatabaseQueue.m @@ -40,6 +40,10 @@ return q; } ++ (Class)databaseClass +{ + return [FMDatabase class]; +} - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { @@ -47,7 +51,7 @@ if (self != nil) { - _db = [FMDatabase databaseWithPath:aPath]; + _db = [[[self class] databaseClass] databaseWithPath:aPath]; FMDBRetain(_db); #if SQLITE_VERSION_NUMBER >= 3005000 |