diff --git a/dev/pragma.h b/dev/pragma.h index 37de02201..42c604994 100644 --- a/dev/pragma.h +++ b/dev/pragma.h @@ -41,6 +41,10 @@ namespace sqlite_orm { pragma_t(get_connection_t get_connection_) : get_connection(std::move(get_connection_)) {} + std::vector module_list() { + return this->get_pragma>("module_list"); + } + void busy_timeout(int value) { this->set_pragma("busy_timeout", value); } diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index db5ad0531..d04a5c72d 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -13741,6 +13741,10 @@ namespace sqlite_orm { pragma_t(get_connection_t get_connection_) : get_connection(std::move(get_connection_)) {} + std::vector module_list() { + return this->get_pragma>("module_list"); + } + void busy_timeout(int value) { this->set_pragma("busy_timeout", value); } diff --git a/tests/pragma_tests.cpp b/tests/pragma_tests.cpp index 691e9cb42..94995650a 100644 --- a/tests/pragma_tests.cpp +++ b/tests/pragma_tests.cpp @@ -4,6 +4,12 @@ using namespace sqlite_orm; +TEST_CASE("module_list") { + auto storage = make_storage({}); + + std::ignore = storage.pragma.module_list(); +} + TEST_CASE("Journal mode") { auto filename = "journal_mode.sqlite"; ::remove(filename); diff --git a/tests/schema/virtual_table.cpp b/tests/schema/virtual_table.cpp index f374a1ba8..8d96ef86a 100644 --- a/tests/schema/virtual_table.cpp +++ b/tests/schema/virtual_table.cpp @@ -1,8 +1,12 @@ #include #include +#include using namespace sqlite_orm; +using std::cout; +using std::endl; + TEST_CASE("virtual table") { using Catch::Matchers::UnorderedEquals; @@ -20,6 +24,13 @@ TEST_CASE("virtual table") { auto storage = make_storage( "", make_virtual_table("posts", using_fts5(make_column("title", &Post::title), make_column("body", &Post::body)))); + + auto modules = storage.pragma.module_list(); + cout << "[!] modules size = " << modules.size() << endl; + for(auto& moduleName: modules) { + cout << "\t[!] " << moduleName << endl; + } + storage.sync_schema(); REQUIRE(storage.table_exists("posts"));