aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMSQLite.m
diff options
context:
space:
mode:
authorGravatar Nicholas Tsoi-A-Sue <nicktsue@google.com>2020-06-10 11:58:16 -0700
committerGravatar Thomas Van Lenten <thomasvl@google.com>2020-06-10 15:16:36 -0400
commit960dd6068bb7f98d31808a223f4de081efa57e0f (patch)
treed78cb4d19aec8efebbf5cf698cf4015522aa308e /Foundation/GTMSQLite.m
parent1902ad87111e7e1e8ad7b21f515697c91e4427f2 (diff)
Create interface for initializing DB with SQLite flags
Diffstat (limited to 'Foundation/GTMSQLite.m')
-rw-r--r--Foundation/GTMSQLite.m14
1 files changed, 13 insertions, 1 deletions
diff --git a/Foundation/GTMSQLite.m b/Foundation/GTMSQLite.m
index aa5d5f5..d3add68 100644
--- a/Foundation/GTMSQLite.m
+++ b/Foundation/GTMSQLite.m
@@ -133,13 +133,14 @@ static CFLocaleRef gCurrentLocale = NULL;
- (id)initWithPath:(NSString *)path
withCFAdditions:(BOOL)additions
utf8:(BOOL)useUTF8
+ flags:(int)flags
errorCode:(int *)err {
int rc = SQLITE_INTERNAL;
if ((self = [super init])) {
path_ = [path copy];
if (useUTF8) {
- rc = sqlite3_open([path_ fileSystemRepresentation], &db_);
+ rc = sqlite3_open_v2([path_ fileSystemRepresentation], &db_, flags, NULL);
} else {
CFStringEncoding cfEncoding;
#if TARGET_RT_BIG_ENDIAN
@@ -185,6 +186,17 @@ static CFLocaleRef gCurrentLocale = NULL;
return self;
}
+- (id)initWithPath:(NSString *)path
+ withCFAdditions:(BOOL)additions
+ utf8:(BOOL)useUTF8
+ errorCode:(int *)err {
+ return [self initWithPath:path
+ withCFAdditions:additions
+ utf8:useUTF8
+ flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+ errorCode:err];
+}
+
- (id)initInMemoryWithCFAdditions:(BOOL)additions
utf8:(BOOL)useUTF8
errorCode:(int *)err {