From c7f1ec84eba5213ef5927b8c6300f43c47884da1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 4 Oct 2024 18:28:34 -0300 Subject: 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 --- tests/functional/streq.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 tests/functional/streq.c (limited to 'tests/functional/streq.c') 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 -#include -#include -#include - - - -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 - ); -} -- cgit v1.2.3