aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/streq.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-10-04 18:28:34 -0300
committerEuAndreh <eu@euandre.org>2024-10-05 03:03:29 -0300
commitc7f1ec84eba5213ef5927b8c6300f43c47884da1 (patch)
tree3b2934d53fb4f13d6da07be5daccb9c3db0b4e43 /tests/functional/streq.c
parentMakefile: Store and return bench timing data (diff)
downloadgolite-c7f1ec84eba5213ef5927b8c6300f43c47884da1.tar.gz
golite-c7f1ec84eba5213ef5927b8c6300f43c47884da1.tar.xz
Remove support for dynamically loading extensions
Defer to the user to (statically) include the extension with the rest of the code, and manually registering it, as described in [0]. If support for dynamic libraries and run-time dynamism in general is desired, one shouldn't be looking for it in C or Go, who aren't the greatest bastions of such dynamism, and instead consider more appropriate languages, like Common Lisp or Smalltalk. [0]: https://sqlite.org/loadext.html#statically_linking_a_run_time_loadable_extension
Diffstat (limited to 'tests/functional/streq.c')
-rw-r--r--tests/functional/streq.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/functional/streq.c b/tests/functional/streq.c
deleted file mode 100644
index 70a6aa8..0000000
--- a/tests/functional/streq.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <assert.h>
-#include <stdbool.h>
-#include <string.h>
-#include <sqlite3ext.h>
-
-
-
-SQLITE_EXTENSION_INIT1
-static void
-streq(sqlite3_context *const ctx, const int argc, sqlite3_value **const argv) {
- assert(argc == 2);
- const char *const str1 = (const char *)sqlite3_value_text(argv[0]);
- const char *const str2 = (const char *)sqlite3_value_text(argv[1]);
- const bool equal = strcmp(str1, str2) == 0;
- const int result = equal ? 1 : 0;
- sqlite3_result_int(ctx, result);
-}
-
-int
-sqlite3_extension_init(
- sqlite3 *const db,
- const char *const *const errmsg,
- const sqlite3_api_routines *const api
-) {
- SQLITE_EXTENSION_INIT2(api);
- (void)errmsg;
- return sqlite3_create_function(
- db,
- "streq",
- 2,
- SQLITE_UTF8,
- (void *)db,
- streq,
- NULL,
- NULL
- );
-}