Hello,

Attached is a patch which changes the sqlite-open default optional flags 
argument
value.  If I am not misunderstanding the API doc and the intention behind the 
union
of both sqlite3_open and sqlite3_open_v2 into a single sqlite-open procedure 
with
optional arguments, then the default value should indeed be (logior
SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE)

Cheers,
David
>From a6cd637757a3923d228d07e8a986ac097d4e2bb3 Mon Sep 17 00:00:00 2001
From: David Pirotte <[email protected]>
Date: Fri, 20 Jan 2012 16:03:01 -0200
Subject: [PATCH 2/2] sqlite-open, reviewed

This patch modifies the default optional flags value from 0 to
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE.  The API documentation says:
"... This is the behavior that is always used for sqlite3_open() ... The
sqlite3_open_v2() interface works like sqlite3_open() ..."
---
 sqlite3.scm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sqlite3.scm b/sqlite3.scm
index f3c16ae..726b3ca 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -169,7 +169,7 @@
             int
             (dynamic-func "sqlite3_open_v2" libsqlite3)
             (list '* '* int '*))))
-    (lambda* (filename #:optional (flags 0) (vfs #f))
+    (lambda* (filename #:optional (flags (logior SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE)) (vfs #f))
       (let* ((out-db (bytevector->pointer (make-bytevector (sizeof '*) 0)))
              (ret (f (string->utf8-pointer filename)
                      out-db
-- 
1.7.8.3

Reply via email to