Revision 1701766b
Von Christian Ehringfeld vor etwa 9 Jahren hinzugefügt
README.md | ||
---|---|---|
# CuteEntityManager for Qt
|
||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/upd727lxpxvvxo2v/branch/master?svg=true)](https://ci.appveyor.com/project/Professi/cuteentitymanager/branch/master)
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/upd727lxpxvvxo2v?svg=true)](https://ci.appveyor.com/project/Professi/cuteentitymanager)
|
||
|
||
## English
|
||
With CuteEntityManager it is possible to persist, merge, find or delete
|
src/database.cpp | ||
---|---|---|
}
|
||
|
||
bool Database::rollbackTransaction() {
|
||
this->logger->logMsg("Transaction rolled back!" + this->database.lastError().text(),MsgType::WARNING);
|
||
this->logger->logMsg("Transaction rolled back!" +
|
||
this->database.lastError().text(), MsgType::WARNING);
|
||
return supportTransactions && this->database.rollback();
|
||
}
|
||
|
src/entityinstancefactory.cpp | ||
---|---|---|
}
|
||
|
||
Entity *EntityInstanceFactory::createInstance(const QMetaObject *object) {
|
||
return qobject_cast<Entity *>(object->newInstance());
|
||
auto o = object->newInstance();
|
||
if(o) {
|
||
return qobject_cast<Entity *>(o);
|
||
} else {
|
||
return EntityInstanceFactory::createInstance(object->className());
|
||
}
|
||
}
|
||
|
||
QList<QSharedPointer<Entity> > EntityInstanceFactory::castQVariantList(
|
src/entitymanager.cpp | ||
---|---|---|
}
|
||
|
||
void EntityManager::init(bool inspect, const MsgType msgType) {
|
||
EntityInstanceFactory::registerClass<DatabaseMigration>();
|
||
auto schema = Database::getSchema(Database::getDatabaseType(
|
||
this->db->getDatabase().driverName()), this->db);
|
||
this->schema = QSharedPointer<Schema>(schema);
|
src/querybuilder.cpp | ||
---|---|---|
QSharedPointer<Entity> e;
|
||
for (int var = classes.size() - 1; var >= 0; --var) {
|
||
auto metaObj = classes.at(var);
|
||
e = QSharedPointer<Entity>(EntityInstanceFactory::createInstance(
|
||
metaObj));
|
||
e = QSharedPointer<Entity>(EntityInstanceFactory::createInstance(metaObj));
|
||
if (e) {
|
||
list.append(QueryBuilder::ClassAttributes(e->getTablename(),
|
||
this->saveAttributes(entity, this->processProperties(e, usedProperties),
|
||
... | ... | |
bool ignoreID, const QString &primaryKey) const {
|
||
QString rc = "";
|
||
for (auto i = m.constBegin(); i != m.constEnd(); ++i) {
|
||
if (!ignoreID || (ignoreID && i.key() != primaryKey)) {
|
||
if (!rc.isEmpty()) {
|
||
rc += " " + conjunction + " ";
|
||
}
|
||
rc += this->schema->quoteColumnName(i.key()) + (i.value().isNull() ? " is null":"=" + this->placeHolder(i.key()));
|
||
if (!ignoreID || (ignoreID && i.key() != primaryKey)) {
|
||
if (!rc.isEmpty()) {
|
||
rc += " " + conjunction + " ";
|
||
}
|
||
rc += this->schema->quoteColumnName(i.key()) + (i.value().isNull() ? " is null"
|
||
: "=" + this->placeHolder(i.key()));
|
||
}
|
||
}
|
||
return rc;
|
||
}
|
Auch abrufbar als: Unified diff
ticket #596