Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e3fc2748

Von Christian Ehringfeld vor etwa 8 Jahren hinzugefügt

multiple improvements

Unterschiede anzeigen:

src/entitymanager.cpp
return rc;
}
bool EntityManager::merge(QSharedPointer<Entity> &entity, bool withRelations,
const bool validate, const bool relationsIgnoreHasChanged) {
auto merged = QList<Entity *>();
return this->mergeObject(entity, merged, withRelations, validate,
relationsIgnoreHasChanged);
}
bool EntityManager::create(QSharedPointer<Entity> &entity,
const bool persistRelations, const bool checkDuplicate, const bool validate,
const bool relationsIgnoreHasChanged) {
auto merged = QList<Entity *>();
return this->createObject(entity, merged, persistRelations,
checkDuplicate, validate, relationsIgnoreHasChanged);
}
bool EntityManager::create(QList<QSharedPointer<Entity>> &entities,
const bool persistRelations, const bool checkDuplicate, const bool validate,
const bool relationsIgnoreHasChanged) {
......
return ok;
}
bool EntityManager::save(QSharedPointer<Entity> &entity,
const bool persistRelations, const bool ignoreHasChanged, const bool validate,
const bool relationsIgnoreHasChanged) {
auto merged = QList<Entity *>();
return this->saveObject(entity, merged, persistRelations,
ignoreHasChanged, validate, relationsIgnoreHasChanged);
}
bool EntityManager::save(QList<QSharedPointer<Entity>> &entities,
const bool persistRelations, const bool ignoreHasChanged, const bool validate,
const bool relationsIgnoreHasChanged) {
......
return schema;
}
void EntityManager::refresh(QSharedPointer<Entity> &entity, const bool resolveRelations) {
if(entity) {
auto map = this->findByPk(entity->getId(), entity);
this->convert(map, entity, resolveRelations);
}
}
QList<QHash<QString, QVariant>> EntityManager::selectByQuery(Query &query) {
QSqlQuery q = this->queryInterpreter->build(query);
return this->convertQueryResult(q);
......
return r;
}
bool EntityManager::remove(QSharedPointer<Entity> &entity) {
bool rc = false;
this->db->startTransaction();
this->removeRelations(entity);
auto queries = this->schema->getQueryBuilder()->remove(entity);
bool ok = this->db->exec(queries);
if (ok && this->db->commitTransaction()) {
this->cache.remove(entity);
entity.clear();
rc = true;
} else {
this->db->rollbackTransaction();
}
return rc;
}
bool EntityManager::removeAll(QString tblname) {
return this->schema->getQueryBuilder()->removeAll(tblname).exec();
}

Auch abrufbar als: Unified diff