aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-05-31 15:36:07 +0000
committerdrh <drh@noemail.net>2013-05-31 15:36:07 +0000
commit6dc8cbe0d4f3aa39eb744f940fbdcea0ede260d1 (patch)
tree276a36a998b520b1d2eb6b367f4e0ebcd63daf61 /src/tclsqlite.c
parentee0231ef525bfd25f5f3e237a3f6a3786e56796e (diff)
downloadsqlite-6dc8cbe0d4f3aa39eb744f940fbdcea0ede260d1.tar.gz
sqlite-6dc8cbe0d4f3aa39eb744f940fbdcea0ede260d1.zip
Improved handling of errors when doing run-time loading of an SQLite
shared-library into TCL. FossilOrigin-Name: b3f23d186425d2362b756708cbaf422ba3c751f9
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index f1bb2921d..325e809fa 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -3050,7 +3050,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
*/
#ifndef USE_TCL_STUBS
# undef Tcl_InitStubs
-# define Tcl_InitStubs(a,b,c)
+# define Tcl_InitStubs(a,b,c) TCL_OK
#endif
/*
@@ -3074,19 +3074,18 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** The EXTERN macros are required by TCL in order to work on windows.
*/
EXTERN int Sqlite3_Init(Tcl_Interp *interp){
- Tcl_InitStubs(interp, "8.4", 0);
- Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
- Tcl_PkgProvide(interp, "sqlite3", PACKAGE_VERSION);
-
+ int rc = Tcl_InitStubs(interp, "8.4", 0);
+ if( rc==TCL_OK ){
+ Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
#ifndef SQLITE_3_SUFFIX_ONLY
- /* The "sqlite" alias is undocumented. It is here only to support
- ** legacy scripts. All new scripts should use only the "sqlite3"
- ** command.
- */
- Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0);
+ /* The "sqlite" alias is undocumented. It is here only to support
+ ** legacy scripts. All new scripts should use only the "sqlite3"
+ ** command. */
+ Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0);
#endif
-
- return TCL_OK;
+ rc = Tcl_PkgProvide(interp, "sqlite3", PACKAGE_VERSION);
+ }
+ return rc;
}
EXTERN int Tclsqlite3_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }
EXTERN int Sqlite3_Unload(Tcl_Interp *interp, int flags){ return TCL_OK; }