summaryrefslogtreecommitdiffstats
path: root/ext/misc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:39 +0000
commitcf135f596348fc12f5aee68d206eb1ae0f030a13 (patch)
tree866db2075e714d821ca3d978205d21d88c0ec48d /ext/misc
parentReleasing progress-linux version 3.45.1-1~progress7.99u1. (diff)
downloadsqlite3-cf135f596348fc12f5aee68d206eb1ae0f030a13.tar.xz
sqlite3-cf135f596348fc12f5aee68d206eb1ae0f030a13.zip
Merging upstream version 3.45.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/misc')
-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;
}