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/golite.go | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'tests/golite.go') diff --git a/tests/golite.go b/tests/golite.go index 0747bce..aabe83c 100644 --- a/tests/golite.go +++ b/tests/golite.go @@ -1214,56 +1214,6 @@ func TestFileCopyTruncate(t *testing.T) { } } -func TestExtensionsError(t *testing.T) { - sql.Register("sqlite3_TestExtensionsError", - &SQLiteDriver{ - Extensions: []string{ - "foobar", - }, - }, - ) - - db, err := sql.Open("sqlite3_TestExtensionsError", ":memory:") - if err != nil { - t.Fatal(err) - } - defer db.Close() - - err = db.Ping() - if err == nil { - t.Fatal("expected error loading non-existent extension") - } - - if err.Error() == "not an error" { - t.Fatal("expected error from sqlite3_enable_load_extension to be returned") - } -} - -func TestLoadExtensionError(t *testing.T) { - sql.Register("sqlite3_TestLoadExtensionError", - &SQLiteDriver{ - ConnectHook: func(c *SQLiteConn) error { - return c.LoadExtension("foobar", "") - }, - }, - ) - - db, err := sql.Open("sqlite3_TestLoadExtensionError", ":memory:") - if err != nil { - t.Fatal(err) - } - defer db.Close() - - err = db.Ping() - if err == nil { - t.Fatal("expected error loading non-existent extension") - } - - if err.Error() == "not an error" { - t.Fatal("expected error from sqlite3_enable_load_extension to be returned") - } -} - func TestColumnTableName(t *testing.T) { d := SQLiteDriver{} conn, err := d.Open(":memory:") @@ -3914,8 +3864,6 @@ func MainTest() { { "TestExecCancel", TestExecCancel }, { "TestOpenContext", TestOpenContext }, { "TestFileCopyTruncate", TestFileCopyTruncate }, - { "TestExtensionsError", TestExtensionsError }, - { "TestLoadExtensionError", TestLoadExtensionError }, { "TestColumnTableName", TestColumnTableName }, { "TestFTS3", TestFTS3 }, { "TestFTS4", TestFTS4 }, -- cgit v1.2.3