aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-09-03 15:19:34 +0000
committerdrh <drh@noemail.net>2007-09-03 15:19:34 +0000
commit33f4e02af65cd4ab4292a09cbd9d3d304f4cb536 (patch)
tree6d6d5b6b06e1454dbf4add9450a3dbf9c11eb3a1 /src/tclsqlite.c
parentcd2543b6ae6a3ac7dff3232624c93a073824bf06 (diff)
downloadsqlite-33f4e02af65cd4ab4292a09cbd9d3d304f4cb536.tar.gz
sqlite-33f4e02af65cd4ab4292a09cbd9d3d304f4cb536.zip
Honor the SQLITE_OPEN_ flags passed into sqlite3_open_v2(). Some
test cases added but more are needed. Ticket #2616. (CVS 4376) FossilOrigin-Name: 020a2b10d408f51d4ef3211c5f701f5378fd4625
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 86cd06a9e..d2fcf50ec 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -12,7 +12,7 @@
** A TCL Interface to SQLite. Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
-** $Id: tclsqlite.c,v 1.200 2007/08/31 14:31:45 drh Exp $
+** $Id: tclsqlite.c,v 1.201 2007/09/03 15:19:35 drh Exp $
*/
#include "tcl.h"
#include <errno.h>
@@ -2306,7 +2306,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
if( b ){
- flags &= ~SQLITE_OPEN_READWRITE;
+ flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
flags |= SQLITE_OPEN_READONLY;
}else{
flags &= ~SQLITE_OPEN_READONLY;
@@ -2315,7 +2315,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}else if( strcmp(zArg, "-create")==0 ){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
- if( b ){
+ if( b && (flags & SQLITE_OPEN_READONLY)==0 ){
flags |= SQLITE_OPEN_CREATE;
}else{
flags &= ~SQLITE_OPEN_CREATE;