Skip to content

Commit 6bdd327

Browse files
committed
removed std::string as result of pragma.integrity_check
1 parent 450b459 commit 6bdd327

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

dev/pragma.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,21 @@ namespace sqlite_orm {
8686
this->set_pragma("auto_vacuum", value);
8787
}
8888

89-
template<class R = std::string>
90-
R integrity_check() {
91-
return this->get_pragma<R>("integrity_check");
89+
std::vector<std::string> integrity_check() {
90+
return this->get_pragma<std::vector<std::string>>("integrity_check");
9291
}
9392

94-
template<class R, class T>
95-
R integrity_check(T table_name) {
93+
template<class T>
94+
std::vector<std::string> integrity_check(T table_name) {
9695
std::ostringstream oss;
9796
oss << "integrity_check(" << table_name << ")";
98-
return this->get_pragma<R>(oss.str());
97+
return this->get_pragma<std::vector<std::string>>(oss.str());
9998
}
10099

101-
template<class R>
102-
R integrity_check(int n) {
100+
std::vector<std::string> integrity_check(int n) {
103101
std::ostringstream oss;
104102
oss << "integrity_check(" << n << ")";
105-
return this->get_pragma<R>(oss.str());
103+
return this->get_pragma<std::vector<std::string>>(oss.str());
106104
}
107105

108106
private:

include/sqlite_orm/sqlite_orm.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11349,23 +11349,21 @@ namespace sqlite_orm {
1134911349
this->set_pragma("auto_vacuum", value);
1135011350
}
1135111351

11352-
template<class R = std::string>
11353-
R integrity_check() {
11354-
return this->get_pragma<R>("integrity_check");
11352+
std::vector<std::string> integrity_check() {
11353+
return this->get_pragma<std::vector<std::string>>("integrity_check");
1135511354
}
1135611355

11357-
template<class R, class T>
11358-
R integrity_check(T table_name) {
11356+
template<class T>
11357+
std::vector<std::string> integrity_check(T table_name) {
1135911358
std::ostringstream oss;
1136011359
oss << "integrity_check(" << table_name << ")";
11361-
return this->get_pragma<R>(oss.str());
11360+
return this->get_pragma<std::vector<std::string>>(oss.str());
1136211361
}
1136311362

11364-
template<class R>
11365-
R integrity_check(int n) {
11363+
std::vector<std::string> integrity_check(int n) {
1136611364
std::ostringstream oss;
1136711365
oss << "integrity_check(" << n << ")";
11368-
return this->get_pragma<R>(oss.str());
11366+
return this->get_pragma<std::vector<std::string>>(oss.str());
1136911367
}
1137011368

1137111369
private:

tests/pragma_tests.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ TEST_CASE("Integrity Check") {
139139
make_column("email", &User::email, default_value("dummy@email.com"))));
140140
storage.sync_schema();
141141

142-
REQUIRE(storage.pragma.integrity_check() == "ok");
143-
REQUIRE(storage.pragma.integrity_check<std::string>(5) == "ok");
144-
REQUIRE(storage.pragma.integrity_check<std::vector<std::string>>(5) == std::vector<std::string>{"ok"});
145-
REQUIRE(storage.pragma.integrity_check<std::string>(tablename) == "ok");
146-
REQUIRE(storage.pragma.integrity_check<std::vector<std::string>>() == std::vector<std::string>{"ok"});
142+
REQUIRE(storage.pragma.integrity_check() == std::vector<std::string>{"ok"});
143+
REQUIRE(storage.pragma.integrity_check(5) == std::vector<std::string>{"ok"});
144+
REQUIRE(storage.pragma.integrity_check(tablename) == std::vector<std::string>{"ok"});
147145
}

0 commit comments

Comments
 (0)