Revision 74364e5e
Von Christian Ehringfeld vor mehr als 10 Jahren hinzugefügt
| src/entitymanager.cpp | ||
|---|---|---|
|
}
|
||
|
|
||
|
bool EntityManager::merge(QSharedPointer<Entity> &entity, bool withRelations) {
|
||
|
bool ok = false;
|
||
|
if (entity->getId() > -1) {
|
||
|
if (withRelations) {
|
||
|
this->savePrePersistedRelations(entity);
|
||
| ... | ... | |
|
this->db->startTransaction();
|
||
|
QList<QSqlQuery> q = this->schema->getQueryBuilder()->merge(
|
||
|
entity);
|
||
|
bool ok = this->db->exec(q);
|
||
|
ok = this->db->exec(q);
|
||
|
if (!ok || !this->db->commitTransaction()) {
|
||
|
this->db->rollbackTransaction();
|
||
|
return false;
|
||
| ... | ... | |
|
this->savePostPersistedRelations(entity);
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
return ok;
|
||
|
}
|
||
|
|
||
|
QHash<QString, QVariant> EntityManager::findByPk(qint64 id,
|
||
Auch abrufbar als: Unified diff
again small fix