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:
authorDanOrange <dan@14oranges.com>2014-01-18 09:43:48 +0400
committerDanOrange <dan@14oranges.com>2014-01-18 09:43:48 +0400
commit294d54c1e08f4a5a88f3550f67e4aa316eb65a35 (patch)
treea2ee27477b50dd902231493b3814079c4d7da0b7
parentd54f817686236ee0c3a867c756781726de28b923 (diff)
Fixed [FMDatabase openWithFlags:] so it does not reopen the db unnecessarily
This is just copying what was done in [FMDatabase open:] by return YES if the database already exists. This solves a problem with issue #211 where any connection changes being made in the [FMDatabasePoolDelegeate databasePool: didAddDatabase:] would just get reset as the database would be reopened on each pool call. Likely inefficent as well.
-rw-r--r--src/FMDatabase.m4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/FMDatabase.m b/src/FMDatabase.m
index 51765cc..445ecb0 100644
--- a/src/FMDatabase.m
+++ b/src/FMDatabase.m
@@ -112,6 +112,10 @@
#if SQLITE_VERSION_NUMBER >= 3005000
- (BOOL)openWithFlags:(int)flags {
+ if (_db) {
+ return YES;
+ }
+
int err = sqlite3_open_v2([self sqlitePath], &_db, flags, NULL /* Name of VFS module to use */);
if(err != SQLITE_OK) {
NSLog(@"error opening!: %d", err);