Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d2c33642

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID d2c33642aa3ef074e4b9633a8b69f23960bdca28
  • Vorgänger 554f7bc0
  • Nachfolger a473cd61

temporary fix for #578

Unterschiede anzeigen:

samples/example/main.cpp
q.setLimit(10);
QList<QSharedPointer<Pupil>> list = e->find<Pupil>(q, true);
for (int i = 0; i < list.size(); ++i) {
// qWarning() << "-----------------------------";
// qWarning() << "Merge Pupil";
// qWarning() << "-----------------------------";
// list.at(i)->setBirthday(QDate(2222,12,22));
// QSharedPointer<Entity> pupilE = list.at(i).objectCast<Entity>();
// e->merge(pupilE,true);
qWarning() << "-----------------------------";
qWarning() << "Merge Pupil";
qWarning() << "-----------------------------";
list.at(i)->setBirthday(QDate(2222,12,22));
QSharedPointer<Entity> pupilE = list.at(i).objectCast<Entity>();
e->merge(pupilE,true);
qWarning() << list.at(i)->toString();
}
qWarning() << "-----------------------------";
src/entitymanager.cpp
bool EntityManager::hasChanged(QSharedPointer<Entity> &entity) {
bool changed = true;
if (entity->getId() >= -1) {
if (entity->getId() > -1) {
changed = false;
auto listmap = this->findByPk(entity->getId(), entity);
auto relations = entity->getRelations();
......
}
}
}
}
return changed;
}
......
QSharedPointer<Entity> ptr;
for (int var = 0; var < list.size(); ++var) {
ptr = list.at(var);
if (this->shouldBeSaved(ptr, r) && this->save(ptr)) {
if (this->shouldBeSaved(ptr, r) && this->hasChanged(ptr) && this->save(ptr)) {
saved.append(ptr);
}
}
src/querybuilder.cpp
queries.append(superIndex);
}
queries.append(this->relationFks(entity));
qDebug() << "create index:" << entity->getTablename() << queries.size();
ok = this->database->transaction(queries);
return ok;
}

Auch abrufbar als: Unified diff