Commit aba6043b authored by Ronan's avatar Ronan

fix(MainDb): remove CHECK_LEGACY_TABLE_EXISTS macro

parent 21e426b9
......@@ -1186,18 +1186,18 @@ void MainDbPrivate::updateSchema () {
// -----------------------------------------------------------------------------
#define CHECK_LEGACY_TABLE_EXISTS(SESSION, NAME) \
do { \
SESSION << "SELECT name FROM sqlite_master WHERE type='table' AND name='" NAME "'"; \
return SESSION.got_data() > 0; \
} while (false);
// NOTE: Legacy supports only sqlite.
static inline bool checkLegacyTableExists (soci::session &session, const string &name) {
session << "SELECT name FROM sqlite_master WHERE type='table' AND name = :name", soci::use(name);
return session.got_data() > 0;
}
static inline bool checkLegacyFriendsTableExists (soci::session &session) {
CHECK_LEGACY_TABLE_EXISTS(session, "friends");
return checkLegacyTableExists(session, "friends");
}
static inline bool checkLegacyHistoryTableExists (soci::session &session) {
CHECK_LEGACY_TABLE_EXISTS(session, "history");
return checkLegacyTableExists(session, "history");
}
template<typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment