Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ccgus/fmdb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Bernard <pierre.bernard@web.de>2016-04-05 14:45:38 +0300
committerPierre Bernard <pierre.bernard@web.de>2016-04-05 14:45:38 +0300
commit4d7c8842ae0254b2b645d52d59462ff62d0badec (patch)
tree10a76ac2c198bf1e750642d6067016d368d36b96
parentcff49e08e67fdaf544079b6f0b66117a7b7be522 (diff)
Use custom db class when re-opening database
Re-opening the database did not use custom databaseClass nor vfsName
-rwxr-xr-x[-rw-r--r--]src/fmdb/FMDatabaseQueue.h5
-rwxr-xr-x[-rw-r--r--]src/fmdb/FMDatabaseQueue.m6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/fmdb/FMDatabaseQueue.h b/src/fmdb/FMDatabaseQueue.h
index ae45b65..cbc4331 100644..100755
--- a/src/fmdb/FMDatabaseQueue.h
+++ b/src/fmdb/FMDatabaseQueue.h
@@ -65,6 +65,7 @@
dispatch_queue_t _queue;
FMDatabase *_db;
int _openFlags;
+ NSString *_vfsName;
}
/** Path of database */
@@ -75,6 +76,10 @@
@property (atomic, readonly) int openFlags;
+/** Custom virtual file system name */
+
+@property (atomic, copy) NSString *vfsName;
+
///----------------------------------------------------
/// @name Initialization, opening, and closing of queue
///----------------------------------------------------
diff --git a/src/fmdb/FMDatabaseQueue.m b/src/fmdb/FMDatabaseQueue.m
index c877a34..1ae15da 100644..100755
--- a/src/fmdb/FMDatabaseQueue.m
+++ b/src/fmdb/FMDatabaseQueue.m
@@ -34,6 +34,7 @@ static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey
@synthesize path = _path;
@synthesize openFlags = _openFlags;
+@synthesize vfsName = _vfsName;
+ (instancetype)databaseQueueWithPath:(NSString*)aPath {
@@ -82,6 +83,7 @@ static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey
_queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL);
dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
_openFlags = openFlags;
+ _vfsName = [vfsName copy];
}
return self;
@@ -128,10 +130,10 @@ static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey
- (FMDatabase*)database {
if (!_db) {
- _db = FMDBReturnRetained([FMDatabase databaseWithPath:_path]);
+ _db = FMDBReturnRetained([[[self class] databaseClass] databaseWithPath:_path]);
#if SQLITE_VERSION_NUMBER >= 3005000
- BOOL success = [_db openWithFlags:_openFlags];
+ BOOL success = [_db openWithFlags:_openFlags vfs:_vfsName];
#else
BOOL success = [_db open];
#endif