mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
feat(MainDb): add an events module with 1.0.0 version
This commit is contained in:
parent
a3325dbd4f
commit
cc0a509a97
3 changed files with 30 additions and 0 deletions
|
|
@ -82,6 +82,9 @@ void l_assert (const char *condition, const char *file, int line);
|
|||
#define L_UNLIKELY(EXPRESSION) EXPRESSION
|
||||
#endif
|
||||
|
||||
// Define an integer version like: 0xXXYYZZ, XX=MAJOR, YY=MINOR, and ZZ=PATCH.
|
||||
#define L_VERSION(MAJOR, MINOR, PATCH) (((MAJOR) << 16) | ((MINOR) << 8) | (PATCH))
|
||||
|
||||
class BaseObject;
|
||||
class BaseObjectPrivate;
|
||||
class ClonableObject;
|
||||
|
|
|
|||
|
|
@ -147,6 +147,13 @@ private:
|
|||
|
||||
void invalidConferenceEventsFromQuery (const std::string &query, long long chatRoomId);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Versions.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
unsigned int getModuleVersion (const std::string &name);
|
||||
void updateModuleVersion (const std::string &name, unsigned int version);
|
||||
|
||||
L_DECLARE_PUBLIC(MainDb);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
#include "main-db-key-p.h"
|
||||
#include "main-db-p.h"
|
||||
|
||||
#define DB_MODULE_VERSION_EVENTS L_VERSION(1, 0, 0)
|
||||
|
||||
// =============================================================================
|
||||
|
||||
// See: http://soci.sourceforge.net/doc/3.2/exchange.html
|
||||
|
|
@ -1019,6 +1021,22 @@ static constexpr string &blobToString (string &in) {
|
|||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int MainDbPrivate::getModuleVersion (const string &name) {
|
||||
soci::session *session = dbSession.getBackendSession<soci::session>();
|
||||
|
||||
unsigned int version;
|
||||
*session << "SELECT version FROM db_module_version WHERE name = :name", soci::into(version), soci::use(name);
|
||||
return session->got_data() ? version : 0;
|
||||
}
|
||||
|
||||
void MainDbPrivate::updateModuleVersion (const string &name, unsigned int version) {
|
||||
soci::session *session = dbSession.getBackendSession<soci::session>();
|
||||
*session << "REPLACE INTO db_module_version (name, version) VALUES (:name, :version)",
|
||||
soci::use(name), soci::use(version);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void MainDb::init () {
|
||||
|
|
@ -1310,6 +1328,8 @@ static constexpr string &blobToString (string &in) {
|
|||
" name" + varcharPrimaryKeyStr(16) + ","
|
||||
" version INT UNSIGNED NOT NULL"
|
||||
") " + charset;
|
||||
|
||||
d->updateModuleVersion("events", DB_MODULE_VERSION_EVENTS);
|
||||
}
|
||||
|
||||
bool MainDb::addEvent (const shared_ptr<EventLog> &eventLog) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue