Revision d84c91e7
Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt
src/entitymanager.cpp | ||
---|---|---|
DatabaseMigration *dbm = new DatabaseMigration();
|
||
QSharedPointer<Entity> ptrDbm = QSharedPointer<Entity>(dbm);
|
||
QHash<QString, QVariant> map = QHash<QString, QVariant>();
|
||
bool ok = true;
|
||
map.insert("version", version);
|
||
if (this->findAllByAttributes(map, dbm->getTablename()).isEmpty()) {
|
||
for (int var = 0; var < toInitialize.size(); ++var) {
|
||
QString c = toInitialize.at(var);
|
||
this->createTable(QSharedPointer<Entity>(EntityInstanceFactory::createInstance(c)));
|
||
if (ok) {
|
||
QString c = toInitialize.at(var);
|
||
ok = this->createTable(QSharedPointer<Entity>(EntityInstanceFactory::createInstance(c)));
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (ok) {
|
||
dbm->setVersion(version);
|
||
dbm->setApplyTime(QDateTime::currentDateTime());
|
||
this->create(ptrDbm);
|
||
}
|
||
dbm->setVersion(version);
|
||
dbm->setApplyTime(QDateTime::currentDateTime());
|
||
this->create(ptrDbm);
|
||
}
|
||
delete dbm;
|
||
return ok;
|
||
}
|
||
|
||
EntityManager::EntityManager(const QString &databaseType, QString databasename , QString hostname, QString username,
|
||
... | ... | |
return this->convert(maps, entity.data()->getClassname());
|
||
}
|
||
|
||
bool EntityManager::create(QList<QSharedPointer<Entity> > entities) {
|
||
|
||
}
|
||
|
||
/**
|
||
* @TODO insert Relations
|
||
* @brief EntityManager::create
|
Auch abrufbar als: Unified diff
some stuff