EST Syslog log try odb transaction m_models- database begin EST Mappin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
EST::Syslog log;
try
{
odb::transaction t(m_models->database().begin());
EST::Mapping::LazyModelViewPointer lmvp = m_models->mainView;
QSharedPointer<EST::Mapping::ModelView> mvp = lmvp.load();
QString msgPltxt = QString::fromStdString(msg.Pltxt);
qlonglong msgUniKey = wtf(msg.UniKey).toLongLong();
EST::Mapping::Identifier idNode(msgUniKey);
log.debug(QString("ORM::Check searching for '%1' '%2'")
.arg(idNode.handle())
.arg(msgPltxt));
EST::Mapping::NodeMap nm = mvp->back.node;
foreach(const EST::Mapping::Identifier & mid, nm.keys())
{
if (mid.handle() == idNode.handle())
{
foreach(const EST::Mapping::LazyNodePointer & lnp, nm.values(mid))
{
QSharedPointer<EST::Mapping::Node> np = lnp.load();
if (np->label == msgPltxt)
{
log.debug(QString("ORM::Check found '%1' '%2'")
.arg(idNode.handle())
.arg(msgPltxt));
return true;
}
}
}
}
}
catch(odb::exception &e)
{
EST::Syslog log;
log.critical(QString("ORM::Check failed: %1").arg(e.what()));
return false;
}
return true;