summaryrefslogtreecommitdiffstats
path: root/ext/misc/noop.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:38 +0000
commit8cb0288fa14ba73d0f6eea982bb7d30414460bfb (patch)
tree0ea6af723f53807b69ff4060b07381b45def1c15 /ext/misc/noop.c
parentAdding debian version 3.45.1-1. (diff)
downloadsqlite3-8cb0288fa14ba73d0f6eea982bb7d30414460bfb.tar.xz
sqlite3-8cb0288fa14ba73d0f6eea982bb7d30414460bfb.zip
Merging upstream version 3.45.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/misc/noop.c')
-rw-r--r--ext/misc/noop.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/misc/noop.c b/ext/misc/noop.c
index d3a5867..18c25e1 100644
--- a/ext/misc/noop.c
+++ b/ext/misc/noop.c
@@ -38,6 +38,24 @@ static void noopfunc(
sqlite3_result_value(context, argv[0]);
}
+/*
+** Implementation of the multitype_text() function.
+**
+** The function returns its argument. The result will always have a
+** TEXT value. But if the original input is numeric, it will also
+** have that numeric value.
+*/
+static void multitypeTextFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ assert( argc==1 );
+ (void)argc;
+ (void)sqlite3_value_text(argv[0]);
+ sqlite3_result_value(context, argv[0]);
+}
+
#ifdef _WIN32
__declspec(dllexport)
#endif
@@ -64,5 +82,9 @@ int sqlite3_noop_init(
rc = sqlite3_create_function(db, "noop_nd", 1,
SQLITE_UTF8,
0, noopfunc, 0, 0);
+ if( rc ) return rc;
+ rc = sqlite3_create_function(db, "multitype_text", 1,
+ SQLITE_UTF8,
+ 0, multitypeTextFunc, 0, 0);
return rc;
}