Skip to content

Commit

Permalink
added module_list
Browse files Browse the repository at this point in the history
  • Loading branch information
fnc12 committed Sep 24, 2023
1 parent cb20f98 commit e54e0a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dev/pragma.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ namespace sqlite_orm {

pragma_t(get_connection_t get_connection_) : get_connection(std::move(get_connection_)) {}

std::vector<std::string> module_list() {
return this->get_pragma<std::vector<std::string>>("module_list");
}

void busy_timeout(int value) {
this->set_pragma("busy_timeout", value);
}
Expand Down
4 changes: 4 additions & 0 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13741,6 +13741,10 @@ namespace sqlite_orm {

pragma_t(get_connection_t get_connection_) : get_connection(std::move(get_connection_)) {}

std::vector<std::string> module_list() {
return this->get_pragma<std::vector<std::string>>("module_list");
}

void busy_timeout(int value) {
this->set_pragma("busy_timeout", value);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/pragma_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions tests/schema/virtual_table.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch_all.hpp>
#include <iostream>

using namespace sqlite_orm;

using std::cout;
using std::endl;

TEST_CASE("virtual table") {
using Catch::Matchers::UnorderedEquals;

Expand All @@ -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"));

Expand Down

0 comments on commit e54e0a0

Please sign in to comment.