Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f9dccfc5

Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt

  • ID f9dccfc539f4c0b8e4acc2c0a77de8e8200b28fa
  • Vorgänger 95a2ba7e
  • Nachfolger be2e9500

m-n

Unterschiede anzeigen:

src/attribute.cpp
}
QString Attribute::toString() const {
return this->name + " " + this->columnName + " " + this->tableName + " " +
this->relatedTable + " " + this->relatedColumnName + " " + this->conjunctedTable;
return ("Attribute: " + this->name + " " + this->columnName + " " + this->tableName + " " +
this->relatedTable + " " + this->relatedColumnName + " " + this->conjunctedTable);
}
src/attributeresolver.cpp
#include "attributeresolver.h"
#include "entityhelper.h"
#include "querybuilder.h"
#include <QDebug>
using namespace CuteEntityManager;
AttributeResolver::AttributeResolver(QSharedPointer<QueryBuilder> queryBuilder) {
......
const QString &attr, const Relation &r, const QSharedPointer<Entity> &target) {
auto ptr = e;
QString attributeName = r.getPropertyName();
QString foreignColumnName = target->getTablename();
auto baseObj = EntityHelper::getBaseClassObject(e, attributeName);
Entity* foreignBaseObj = target.data();
if (!r.getMappedBy().isEmpty()) {
ptr = target;
attributeName = r.getMappedBy();
foreignBaseObj = EntityHelper::getBaseClassObject(ptr, attributeName);
foreignColumnName = foreignBaseObj->getTablename();
}
auto obj = EntityHelper::getBaseClassObject(e, attributeName);
/**
* @todo check inheritance and mappedBy
*/
Attribute *attrObj = new Attribute(attr,
this->qb->generateColumnNameID(obj->getTablename()),
e->getTablename(), e->metaObject());
this->qb->generateColumnNameID(baseObj->getTablename()),
baseObj->getTablename(), e->metaObject());
this->resolveInheritance(e, attrObj);
attrObj->setRelation(target->getTablename(), target->metaObject(), r,
this->qb->generateManyToManyTableName(target->getTablename(), attributeName),
this->qb->generateColumnNameID(target->getTablename()));
delete obj;
attrObj->setRelation(foreignBaseObj->getTablename(), target->metaObject(), r,
this->qb->generateManyToManyTableName(foreignBaseObj->getTablename(), attributeName),
this->qb->generateColumnNameID(foreignColumnName));
delete baseObj;
if(foreignBaseObj != target.data()) {
delete foreignBaseObj;
}
qDebug() << "RESOLVE";
return attrObj;
}

Auch abrufbar als: Unified diff