summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite_driver.c
diff options
context:
space:
mode:
authorBohwaZ <bohwaz@github.com>2017-09-04 11:02:12 +1200
committerJoe Watkins <krakjoe@php.net>2017-09-06 09:56:02 +0100
commited2f6510da7c68b5690c60344cbb9fe73241592a (patch)
treec655116faa99c0e05f35c7167f493100f14c343a /ext/pdo_sqlite/sqlite_driver.c
parentfafd67cb71e2d47f7cae3a74d9371fe6cda55442 (diff)
downloadphp-git-ed2f6510da7c68b5690c60344cbb9fe73241592a.tar.gz
Add support for SQLite open flags
Diffstat (limited to 'ext/pdo_sqlite/sqlite_driver.c')
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index e234406be9..1b4fecae81 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -791,7 +791,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{
{
pdo_sqlite_db_handle *H;
int i, ret = 0;
- zend_long timeout = 60;
+ zend_long timeout = 60, flags;
char *filename;
H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent);
@@ -809,7 +809,14 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{
goto cleanup;
}
+ flags = pdo_attr_lval(driver_options, PDO_SQLITE_ATTR_OPEN_FLAGS, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
+
+#if SQLITE_VERSION_NUMBER >= 3005000
+ i = sqlite3_open_v2(filename, &H->db, flags, NULL);
+#else
i = sqlite3_open(filename, &H->db);
+#endif
+
efree(filename);
if (i != SQLITE_OK) {