diff options
author | drh <drh@noemail.net> | 2016-01-22 23:17:51 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-01-22 23:17:51 +0000 |
commit | 147ef3948622234303ef6d38c38e6ee9fe325928 (patch) | |
tree | 27d4057fe610d2093603bbceb7773f8daf7be995 /src/tclsqlite.c | |
parent | a8a18734857f3ad96403acecc201effaab473fb7 (diff) | |
download | sqlite-147ef3948622234303ef6d38c38e6ee9fe325928.tar.gz sqlite-147ef3948622234303ef6d38c38e6ee9fe325928.zip |
In the TCL interface, if a database connection object was opened with
the -uri 1 option, then also honor URI filenames for the "backup" and
"restore" commands.
FossilOrigin-Name: a1c8116ced62d81f3f5ca26bbe0877e829d4cc56
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 604e89826..aa913ca7c 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -153,6 +153,7 @@ struct SqliteDb { IncrblobChannel *pIncrblob;/* Linked list of open incrblob channels */ int nStep, nSort, nIndex; /* Statistics for most recent operation */ int nTransaction; /* Number of nested [transaction] methods */ + int openFlags; /* Flags used to open. (SQLITE_OPEN_URI) */ #ifdef SQLITE_TEST int bLegacyPrepare; /* True to use sqlite3_prepare() */ #endif @@ -1750,7 +1751,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? FILENAME"); return TCL_ERROR; } - rc = sqlite3_open(zDestFile, &pDest); + rc = sqlite3_open_v2(zDestFile, &pDest, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE| pDb->openFlags, 0); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "cannot open target database: ", sqlite3_errmsg(pDest), (char*)0); @@ -2613,7 +2615,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? FILENAME"); return TCL_ERROR; } - rc = sqlite3_open_v2(zSrcFile, &pSrc, SQLITE_OPEN_READONLY, 0); + rc = sqlite3_open_v2(zSrcFile, &pSrc, + SQLITE_OPEN_READONLY | pDb->openFlags, 0); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "cannot open source database: ", sqlite3_errmsg(pSrc), (char*)0); @@ -3088,6 +3091,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ return TCL_ERROR; } p->maxStmt = NUM_PREPARED_STMTS; + p->openFlags = flags & SQLITE_OPEN_URI; p->interp = interp; zArg = Tcl_GetStringFromObj(objv[1], 0); if( DbUseNre() ){ |