diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/func.c | 12 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/func.c b/src/func.c index ea30997a3..a5ded41f5 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.50 2004/05/24 12:39:02 danielk1977 Exp $ +** $Id: func.c,v 1.51 2004/05/24 12:55:55 danielk1977 Exp $ */ #include <ctype.h> #include <math.h> @@ -59,8 +59,16 @@ static void minmaxFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** Return the type of the argument. */ static void typeofFunc(sqlite_func *context, int argc, sqlite3_value **argv){ + const char *z = 0; assert( argc==2 ); - sqlite3_set_result_string(context, sqlite3_value_data(argv[1]), -1); + switch( sqlite3_value_type(argv[0]) ){ + case SQLITE3_NULL: z = "null" ; break; + case SQLITE3_INTEGER: z = "integer" ; break; + case SQLITE3_TEXT: z = "text" ; break; + case SQLITE3_FLOAT: z = "real" ; break; + case SQLITE3_BLOB: z = "blob" ; break; + } + sqlite3_set_result_string(context, z, -1); } /* diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1c99bd80e..7a518ca8e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.248 2004/05/24 07:04:26 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.249 2004/05/24 12:55:55 danielk1977 Exp $ */ #include "config.h" #include "sqlite.h" @@ -464,7 +464,7 @@ struct sqlite { ** points to a linked list of these structures. */ struct FuncDef { - void (*xFunc)(sqlite_func*,int,const char**); /* Regular function */ + void (*xFunc)(sqlite_func*,int,sqlite3_value**); /* Regular function */ void (*xStep)(sqlite_func*,int,const char**); /* Aggregate function step */ void (*xFinalize)(sqlite_func*); /* Aggregate function finializer */ signed char nArg; /* Number of arguments. -1 means unlimited */ |