Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 97846191

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 9784619116e4f15059ea700c38e3517a2204a0ad
  • Vorgänger 706de2e8
  • Nachfolger c599658a

formatting

Unterschiede anzeigen:

src/entity.h
qint64 id;
};
}
Q_DECLARE_METATYPE(QList<QSharedPointer<CuteEntityManager::Entity>>)
#endif // ENTITY_H
src/entityinstancefactory.cpp
QString r = "";
const QString sptr = "QSharedPointer";
if (s.contains(sptr)) {
const int index = s.indexOf(sptr) + sptr.count() +1;
r = s.mid(index,s.indexOf(">",index)-index);
const int index = s.indexOf(sptr) + sptr.count() + 1;
r = s.mid(index, s.indexOf(">", index) - index);
} else {
r = s;
}
src/entitymanager.cpp
} else {
tblName = builder.data()->generateManyToManyTableName(secEntityPtr, entity);
}
/**
* maybe it would be better, to fetch first the ids, look up cache and then request missing entities
*/
QSqlQuery q = this->schema.data()->getQueryBuilder().data()->manyToMany(tblName,
builder.data()->generateManyToManyColumnName(entity), entity.data()->getId(),
builder.data()->generateManyToManyColumnName(secEntityPtr),
src/entitymanager.h
QList<QHash<QString, QVariant> > findAllByAttributes(const QHash<QString, QVariant> &m, const QString &tblname,
bool ignoreID = false);
QSharedPointer<Entity> findById(const qint64 &id, Entity *&e);
void setListProperty(const QSharedPointer<Entity> &entity,QList<QSharedPointer<Entity>> &list,const QMetaProperty &property) const;
void setListProperty(const QSharedPointer<Entity> &entity, QList<QSharedPointer<Entity>> &list,
const QMetaProperty &property) const;
public:
EntityManager(QSqlDatabase database);
src/querybuilder.h
QString transformAbstractTypeToRealDbType(QString typeName) const;
QString getColumnType(const QString &type) const;
QSqlQuery find(const qint64 &id, const QString &tableName) const;
QSqlQuery findByAttributes(const QHash<QString, QVariant> &m, const QString &tableName, const bool &ignoreID = true) const;
QSqlQuery findByAttributes(const QSharedPointer<Entity> &e,bool ignoreID = true);
QSqlQuery findByAttributes(const QHash<QString, QVariant> &m, const QString &tableName,
const bool &ignoreID = true) const;
QSqlQuery findByAttributes(const QSharedPointer<Entity> &e, bool ignoreID = true);
QSqlQuery findAll(const QString &tableName) const;
QSqlQuery remove(const QSharedPointer<Entity> &entity) const;
QSqlQuery findId(const QSharedPointer<Entity> &entity) const;
......
QSqlQuery merge(const QSharedPointer<Entity> &entity) const;
QSqlQuery create(const QSharedPointer<Entity> &entity) const;
QSqlQuery oneToMany(const QString &tableName, const QString &attribute, const qint64 &id);
QSqlQuery manyToMany(const QString &tableName, const QString &attribute, const qint64 &id, const QString &foreignKey, const QString &foreignTable);
QSqlQuery manyToMany(const QString &tableName, const QString &attribute, const qint64 &id, const QString &foreignKey,
const QString &foreignTable);
virtual QString limit(const qint8 limit, const qint64 offset) const;
QString generateManyToManyColumnName(const QSharedPointer<Entity> &entity) const;
QSqlQuery getQuery() const;

Auch abrufbar als: Unified diff