mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Added fetch contents' app data from db
This commit is contained in:
parent
b8b82f7fdb
commit
385aeb3357
1 changed files with 12 additions and 2 deletions
|
|
@ -487,13 +487,13 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
|||
soci::rowset<soci::row> rows = (session->prepare << query, soci::use(eventId));
|
||||
for (const auto &row : rows) {
|
||||
ContentType contentType(row.get<string>(2));
|
||||
const long long &contentId = resolveId(row, 0);
|
||||
Content *content;
|
||||
|
||||
if (contentType == ContentType::FileTransfer)
|
||||
content = new FileTransferContent();
|
||||
else if (contentType.isFile()) {
|
||||
const long long &contentId = resolveId(row, 0);
|
||||
|
||||
// 2.1 - Fetch contents' file informations.
|
||||
string name;
|
||||
int size;
|
||||
string path;
|
||||
|
|
@ -511,6 +511,16 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
|||
} else
|
||||
content = new Content();
|
||||
|
||||
// 2.2 - Fetch contents' app data.
|
||||
static const string content_app_data_query = "SELECT name, data FROM chat_message_content_app_data"
|
||||
" WHERE chat_message_content_id = :messageContentId";
|
||||
soci::rowset<soci::row> content_app_data_rows = (session->prepare << content_app_data_query, soci::use(contentId));
|
||||
for (const auto &content_app_data_row : content_app_data_rows) {
|
||||
string content_app_data_name(content_app_data_row.get<string>(0));
|
||||
string content_app_data_value(content_app_data_row.get<string>(1));
|
||||
content->setAppData(content_app_data_name, content_app_data_value);
|
||||
}
|
||||
|
||||
content->setContentType(contentType);
|
||||
content->setBody(row.get<string>(3));
|
||||
chatMessage->addContent(*content);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue