1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

In the TCL interface, the "sqlite" command now always returns the address

of the "sqlite*" pointer that sqlite_open() returns.  It used to do this
only when compiled with the SQLITE_TEST macro defined. (CVS 648)

FossilOrigin-Name: 9ca6368525fe81fe9c78c6911f4d23009ce858d5
This commit is contained in:
drh
2002-06-26 20:06:05 +00:00
parent b13632063d
commit 06b2718a5f
5 changed files with 28 additions and 26 deletions

View File

@@ -11,11 +11,11 @@
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.33 2002/06/25 19:31:18 drh Exp $
** $Id: tclsqlite.c,v 1.34 2002/06/26 20:06:06 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
#include "sqlite.h"
#include "sqliteInt.h"
#include "tcl.h"
#include <stdlib.h>
#include <string.h>
@@ -543,6 +543,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){
int mode;
SqliteDb *p;
char *zErrMsg;
char zBuf[80];
if( argc==2 ){
if( strcmp(argv[1],"-encoding")==0 ){
Tcl_AppendResult(interp,sqlite_encoding,0);
@@ -583,18 +584,19 @@ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){
}
Tcl_CreateObjCommand(interp, argv[1], DbObjCmd, (char*)p, DbDeleteCmd);
/* The return value is the value of the sqlite* pointer
*/
sprintf(zBuf, "%p", p->db);
Tcl_AppendResult(interp, zBuf, 0);
/* If compiled with SQLITE_TEST turned on, then register the "md5sum"
** SQL function and return an integer which is the memory address of
** the underlying sqlite* pointer.
** SQL function.
*/
#ifdef SQLITE_TEST
{
char zBuf[40];
extern void Md5_Register(sqlite*);
Md5_Register(p->db);
sprintf(zBuf, "%d", (int)p->db);
Tcl_AppendResult(interp, zBuf, 0);
}
}
#endif
return TCL_OK;
}