diff options
author | drh <drh@noemail.net> | 2001-04-06 16:13:42 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2001-04-06 16:13:42 +0000 |
commit | fbc3eab85baaebf21b2d75f90e97d123458bafcb (patch) | |
tree | 9456d0566dd248659f1057d1f4a4ba172393c714 /src | |
parent | 5ef3872a006bcfde058bf68ed3c20c2bda4cbb39 (diff) | |
download | sqlite-fbc3eab85baaebf21b2d75f90e97d123458bafcb.tar.gz sqlite-fbc3eab85baaebf21b2d75f90e97d123458bafcb.zip |
Check for miscompiled Tcl (CVS 204)
FossilOrigin-Name: 735d8b5c13b5e2602b37940377fced098be210c1
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/sqlite.h.in | 4 | ||||
-rw-r--r-- | src/tclsqlite.c | 30 |
3 files changed, 33 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c index 6a024c620..faab88ee6 100644 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.26 2001/04/05 15:57:13 drh Exp $ +** $Id: main.c,v 1.27 2001/04/06 16:13:43 drh Exp $ */ #include "sqliteInt.h" #include <unistd.h> @@ -195,9 +195,9 @@ const char sqlite_version[] = SQLITE_VERSION; ** following global constant always lets us know. */ #ifdef SQLITE_UTF8 -char sqlite_encoding[] = "UTF-8"; +const char sqlite_encoding[] = "UTF-8"; #else -char sqlite_encoding[] = "iso8859"; +const char sqlite_encoding[] = "iso8859"; #endif /* diff --git a/src/sqlite.h.in b/src/sqlite.h.in index acb67e9aa..425c293c8 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -24,7 +24,7 @@ ** This header file defines the interface that the sqlite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.11 2001/04/05 15:57:13 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.12 2001/04/06 16:13:43 drh Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ @@ -55,7 +55,7 @@ extern const char sqlite_version[]; ** see. The character encoding makes a difference for the LIKE and GLOB ** operators and for the LENGTH() and SUBSTR() functions. */ -extern char sqlite_encoding[]; +extern const char sqlite_encoding[]; /* ** Each open sqlite database is represented by an instance of the diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 6cbb827b5..57df83b86 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -23,7 +23,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.15 2001/04/05 15:57:13 drh Exp $ +** $Id: tclsqlite.c,v 1.16 2001/04/06 16:13:43 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -385,11 +385,38 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** ** The second argument is the name of the directory that contains ** the sqlite database that is to be accessed. +** +** For testing purposes, we also support the following: +** +** sqlite -encoding +** +** Return the encoding used by LIKE and GLOB operators. Choices +** are UTF-8 and iso8859. +** +** sqlite -tcl-uses-utf +** +** Return "1" if compiled with a Tcl uses UTF-8. Return "0" if +** not. Used by tests to make sure the library was compiled +** correctly. */ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){ int mode; SqliteDb *p; char *zErrMsg; + if( argc==2 ){ + if( strcmp(argv[1],"-encoding")==0 ){ + Tcl_AppendResult(interp,sqlite_encoding,0); + return TCL_OK; + } + if( strcmp(argv[1],"-tcl-uses-utf")==0 ){ +#ifdef TCL_UTF_MAX + Tcl_AppendResult(interp,"1",0); +#else + Tcl_AppendResult(interp,"0",0); +#endif + return TCL_OK; + } + } if( argc!=3 && argc!=4 ){ Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], " HANDLE FILENAME ?MODE?\"", 0); @@ -429,7 +456,6 @@ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){ */ int Sqlite_Init(Tcl_Interp *interp){ Tcl_CreateCommand(interp, "sqlite", DbMain, 0, 0); - Tcl_SetVar(interp,"sqlite_encoding",sqlite_encoding,TCL_GLOBAL_ONLY); Tcl_PkgProvide(interp, "sqlite", "1.0"); return TCL_OK; } |