Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8306a974

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 8306a974751e498b7deba7a0944845ee579b9b84
  • Vorgänger 59bf3900
  • Nachfolger 3bfe1c1b

...

Unterschiede anzeigen:

example/main.cpp
auto ep = a.dynamicCast<CuteEntityManager::Entity>();
qDebug() << "Tabelle artikel erstellt:" << e->createTable(ep);
e->create(ep);
qDebug() << "TEST12345678990";
auto artikel = e->findById<Artikel *>(1);
qDebug() << "ArtikelID:" << artikel.data()->getId();
// QSharedPointer<CuteEntityManager::Entity> p = QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann", Person::MALE, "", "", "",
src/entitymanager.cpp
return rc;
}
bool EntityManager::removeAll(QString tblname) {
return this->schema.data()->getQueryBuilder().data()->removeAll(tblname).exec();
}
bool EntityManager::createTable(const QSharedPointer<Entity> &entity) {
return this->schema.data()->getQueryBuilder().data()->createTable(entity);
}
src/entitymanager.h
* @param toInitialize list of entity classnames which database tables should be created
* @return
*/
public slots:
bool startup(QString version, QStringList toInitialize);
bool executeQuery(const QString &query);
static void removeConnectionName(const QString &name);
......
/**
*@TODO use conditions
*/
public:
template<class T> qint8 count(QHash<QString, QString> condition =
QHash<QString, QString>()) {
Entity *e = EntityInstanceFactory::createInstance<T>();
src/querybuilder.cpp
return this->createOrMerge(entity, true);
}
QSqlQuery QueryBuilder::removeAll(const QString &tableName) const {
return this->database.data()->getQuery(this->truncateTable(tableName));
}
QSqlQuery QueryBuilder::insert(const QString &tableName,
QHash<QString, QVariant> &attributes, const QString &primaryKey) const {
attributes.remove(primaryKey);
src/querybuilder.h
QSqlQuery count(const QString &tableName) const;
QList<QSqlQuery> merge(const QSharedPointer<Entity> &entity) const;
QList<QSqlQuery> create(const QSharedPointer<Entity> &entity) const;
QSqlQuery removeAll(const QString &tableName) const;
QSqlQuery oneToMany(const QString &tableName, const QString &attribute,
const qint64 &id,
const qint64 &limit = 0);
src/tableschema.h
class TableSchema {
public:
TableSchema();
~TableSchema();
virtual ~TableSchema();
virtual QSharedPointer<QSqlField> const getColumn(QString name) const;
virtual const QStringList getColumnNames();

Auch abrufbar als: Unified diff