aboutsummaryrefslogtreecommitdiffstats
path: root/src/sqlite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sqlite.c')
-rw-r--r--src/sqlite.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/sqlite.c b/src/sqlite.c
index 0de7488d8fd..99f91fd6da6 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -277,18 +277,28 @@ check_sqlite (Lisp_Object db, bool is_statement)
277 277
278static int db_count = 0; 278static int db_count = 0;
279 279
280DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 1, 0, 280DEFUN ("sqlite-open", Fsqlite_open, Ssqlite_open, 0, 3, 0,
281 doc: /* Open FILE as an sqlite database. 281 doc: /* Open FILE as an sqlite database.
282If FILE is nil, an in-memory database will be opened instead. */) 282If FILE is nil or omitted, an in-memory database will be opened instead.
283 (Lisp_Object file) 283If READONLY is non-nil or omitted, open the database in read-only mode,
284otherwise open it in read-write mode.
285By default, file:// URIs are automatically recognized, unless
286DISABLE-URI is non-nil. */)
287 (Lisp_Object file, Lisp_Object readonly, Lisp_Object disable_uri)
284{ 288{
285 Lisp_Object name; 289 Lisp_Object name;
286 int flags = (SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE); 290 int flags;
291
292 if (!NILP (readonly))
293 flags = SQLITE_OPEN_READONLY;
294 else
295 flags = (SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE);
287#ifdef SQLITE_OPEN_FULLMUTEX 296#ifdef SQLITE_OPEN_FULLMUTEX
288 flags |= SQLITE_OPEN_FULLMUTEX; 297 flags |= SQLITE_OPEN_FULLMUTEX;
289#endif 298#endif
290#ifdef SQLITE_OPEN_URI 299#ifdef SQLITE_OPEN_URI
291 flags |= SQLITE_OPEN_URI; 300 if (NILP (disable_uri))
301 flags |= SQLITE_OPEN_URI;
292#endif 302#endif
293 303
294 if (!init_sqlite_functions ()) 304 if (!init_sqlite_functions ())