mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
Update the typeof() operator to respect manifest types. (CVS 1450)
FossilOrigin-Name: 162cf42e33691f4c9ec3a25abcaa2bdcdca2b5e0
This commit is contained in:
12
src/func.c
12
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user