-
-
Notifications
You must be signed in to change notification settings - Fork 321
pragma_t::integrity_check
(1)
std::vector<std::string> integrity_check();
(2)
std::vector<std::string> integrity_check(int n);
(3)
template<class T>
std::vector<std::string> integrity_check(T table_name);
integrity_check
is a member function of pragma_t class and is used to call PRAGMA integrity_check
. Originally SQLite has three options to call integrity_check
:
PRAGMA integrity_check
PRAGMA integrity_check(N)
PRAGMA integrity_check(TABLENAME)
The first overload calls the first option, the second overload calls the second one and the third overload calls the third one.
The first overload is the shortest and the simplest:
auto checkResult = storage.pragma.integrity_check(); // decltype(checkResult) is std::vector<std::string>
Usually integrity_check
returns one row with 'ok' string so getting a string may be enough. But when database is corrupted integrity_check
can return more than one row so the best way is to obtain results as a vector of strings:
auto checkResult = storage.pragma.integrity_check();
The second overload calls PRAGMA integrity_check(N)
where N
is int
argument you pass.
Example:
auto result = storage.pragma.integrity_check(10); // decltype(result) is std::vector<std::string>
The third overload calls PRAGMA integrity_check(TABLENAME)
where TABLENAME
is the only argument you pass. It has a template type so you can pass any object which has std::ostream& std::operator<<
overload. The simplest options are std::string
, std::string_view
or C string literal (const char*
).
Example:
auto result = storage.pragma.integrity_check("users"); // decltype(result) is std::vector<std::string>