aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/func.c11
-rw-r--r--src/tclsqlite.c10
2 files changed, 19 insertions, 2 deletions
diff --git a/src/func.c b/src/func.c
index 3ca42ca4b..5892b1888 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.22 2002/07/07 16:52:47 drh Exp $
+** $Id: func.c,v 1.23 2002/11/04 19:32:25 drh Exp $
*/
#include <ctype.h>
#include <math.h>
@@ -247,6 +247,14 @@ static void nullifFunc(sqlite_func *context, int argc, const char **argv){
}
}
+/*
+** Implementation of the VERSION(*) function. The result is the version
+** of the SQLite library that is running.
+*/
+static void versionFunc(sqlite_func *context, int argc, const char **argv){
+ sqlite_set_result_string(context, sqlite_version, -1);
+}
+
#ifdef SQLITE_TEST
/*
** This function generates a string of random characters. Used for
@@ -481,6 +489,7 @@ void sqliteRegisterBuiltinFunctions(sqlite *db){
{ "like", 2, SQLITE_NUMERIC, likeFunc },
{ "glob", 2, SQLITE_NUMERIC, globFunc },
{ "nullif", 2, SQLITE_ARGS, nullifFunc },
+ { "sqlite_version",0,SQLITE_TEXT, versionFunc},
#ifdef SQLITE_TEST
{ "randstr", 2, SQLITE_TEXT, randStr },
#endif
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 9037bdac6..2326f7533 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -11,7 +11,7 @@
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.42 2002/09/14 13:47:32 drh Exp $
+** $Id: tclsqlite.c,v 1.43 2002/11/04 19:32:26 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@@ -623,6 +623,10 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** Return the encoding used by LIKE and GLOB operators. Choices
** are UTF-8 and iso8859.
**
+** sqlite -version
+**
+** Return the version number of the SQLite library.
+**
** sqlite -tcl-uses-utf
**
** Return "1" if compiled with a Tcl uses UTF-8. Return "0" if
@@ -639,6 +643,10 @@ static int DbMain(void *cd, Tcl_Interp *interp, int argc, char **argv){
Tcl_AppendResult(interp,sqlite_encoding,0);
return TCL_OK;
}
+ if( strcmp(argv[1],"-version")==0 ){
+ Tcl_AppendResult(interp,sqlite_version,0);
+ return TCL_OK;
+ }
if( strcmp(argv[1],"-tcl-uses-utf")==0 ){
#ifdef TCL_UTF_MAX
Tcl_AppendResult(interp,"1",0);