mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Use the new form of the sqlite3_open() API everywhere. (CVS 1437)
FossilOrigin-Name: b449217318ade3196757bef8aaf7302634f0f9b6
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** A TCL Interface to SQLite
|
||||
**
|
||||
** $Id: tclsqlite.c,v 1.65 2004/05/11 06:17:22 danielk1977 Exp $
|
||||
** $Id: tclsqlite.c,v 1.66 2004/05/22 09:21:21 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
|
||||
|
||||
@@ -1020,13 +1020,13 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
** correctly.
|
||||
*/
|
||||
static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
int mode;
|
||||
SqliteDb *p;
|
||||
void *pKey = 0;
|
||||
int nKey = 0;
|
||||
const char *zArg;
|
||||
char *zErrMsg;
|
||||
const char *zFile;
|
||||
const char *zOpts[2] = {0, 0};
|
||||
char zBuf[80];
|
||||
if( objc==2 ){
|
||||
zArg = Tcl_GetStringFromObj(objv[1], 0);
|
||||
@@ -1072,11 +1072,6 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( objc==3 ){
|
||||
mode = 0666;
|
||||
}else if( Tcl_GetIntFromObj(interp, objv[3], &mode)!=TCL_OK ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zErrMsg = 0;
|
||||
p = (SqliteDb*)Tcl_Alloc( sizeof(*p) );
|
||||
if( p==0 ){
|
||||
@@ -1088,7 +1083,15 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
||||
#ifdef SQLITE_HAS_CODEC
|
||||
p->db = sqlite3_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg);
|
||||
#else
|
||||
p->db = sqlite3_open(zFile, mode, &zErrMsg);
|
||||
if( objc>3 ){
|
||||
zOpts[0] = Tcl_GetString(objv[3]);
|
||||
}
|
||||
sqlite3_open(zFile, &p->db, zOpts);
|
||||
if( SQLITE_OK!=sqlite3_errcode(p->db) ){
|
||||
zErrMsg = strdup(sqlite3_errmsg(p->db));
|
||||
sqlite3_close(p->db);
|
||||
p->db = 0;
|
||||
}
|
||||
#endif
|
||||
if( p->db==0 ){
|
||||
Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
|
||||
|
Reference in New Issue
Block a user