Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
cc0a509a
Commit
cc0a509a
authored
Dec 18, 2017
by
Ronan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(MainDb): add an `events` module with 1.0.0 version
parent
a3325dbd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
include/linphone/utils/general.h
include/linphone/utils/general.h
+3
-0
src/db/main-db-p.h
src/db/main-db-p.h
+7
-0
src/db/main-db.cpp
src/db/main-db.cpp
+20
-0
No files found.
include/linphone/utils/general.h
View file @
cc0a509a
...
...
@@ -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
;
...
...
src/db/main-db-p.h
View file @
cc0a509a
...
...
@@ -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
);
};
...
...
src/db/main-db.cpp
View file @
cc0a509a
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment