Commit 28944e46 authored by Ronan's avatar Ronan
Browse files

feat(MainDb): add new table `db_module_version`

parent e1f4254d
......@@ -6003,8 +6003,6 @@ void _linphone_core_uninit(LinphoneCore *lc)
ms_usleep(10000);
}
lc->chat_rooms = bctbx_list_free_with_data(lc->chat_rooms, (bctbx_list_free_func)linphone_chat_room_unref);
linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down");
#ifdef VIDEO_ENABLED
if (lc->previewstream!=NULL){
......
......@@ -612,12 +612,7 @@ void CallSessionPrivate::setReleased () {
}
referer = nullptr;
transferTarget = nullptr;
#if 0
if (call->chat_room){
linphone_chat_room_unref(call->chat_room);
call->chat_room = NULL;
}
#endif
if (listener)
listener->onCallSessionSetReleased(q->getSharedFromThis());
}
......
......@@ -25,6 +25,8 @@
#include <TargetConditionals.h>
#endif // ifdef __APPLE__
#include "linphone/utils/utils.h"
#include "abstract-db-p.h"
#include "db/session/db-session-provider.h"
#include "logger/logger.h"
......@@ -123,6 +125,20 @@ string AbstractDb::primaryKeyRefStr (const string &type) const {
return "";
}
string AbstractDb::varcharPrimaryKeyStr (int length) const {
L_D();
switch (d->backend) {
case Mysql:
return " VARCHAR(" + Utils::toString(length) + ") AUTO_INCREMENT PRIMARY KEY";
case Sqlite3:
return " VARCHAR(" + Utils::toString(length) + ") PRIMARY KEY";
}
L_ASSERT(false);
return "";
}
string AbstractDb::timestampType () const {
L_D();
......@@ -165,9 +181,6 @@ long long AbstractDb::getLastInsertId () const {
case Sqlite3:
sql = "SELECT last_insert_rowid()";
break;
default:
lWarning() << "Unsupported backend.";
return -1;
}
soci::session *session = d->dbSession.getBackendSession<soci::session>();
......
......@@ -53,6 +53,7 @@ protected:
std::string primaryKeyStr (const std::string &type = "INT") const;
std::string primaryKeyRefStr (const std::string &type = "INT") const;
std::string varcharPrimaryKeyStr (int length) const;
std::string timestampType () const;
......
......@@ -1304,6 +1304,12 @@ static constexpr string &blobToString (string &in) {
*session << participantMessageDeleter;
#endif
*session <<
"CREATE TABLE IF NOT EXISTS db_module_version ("
" name" + varcharPrimaryKeyStr(16) + ","
" version INT UNSIGNED NOT NULL"
") " + charset;
}
bool MainDb::addEvent (const shared_ptr<EventLog> &eventLog) {
......
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