From 960dd6068bb7f98d31808a223f4de081efa57e0f Mon Sep 17 00:00:00 2001 From: Nicholas Tsoi-A-Sue Date: Wed, 10 Jun 2020 11:58:16 -0700 Subject: Create interface for initializing DB with SQLite flags --- Foundation/GTMSQLite.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Foundation/GTMSQLite.m') 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 { -- cgit v1.2.3