Herunterladen als
root/example/main.cpp @ c22391b2
81c23b56 | Christian Ehringfeld | #include <QCoreApplication>
|
|
#include <typeinfo>
|
|||
#include <QDir>
|
|||
#include <QDebug>
|
|||
9d05e414 | Christian Ehringfeld | #include "models/artikel.h"
|
|
#include "models/person.h"
|
|||
#include <typeinfo>
|
|||
#include <QMetaMethod>
|
|||
#include <QMetaProperty>
|
|||
#include "models/group.h"
|
|||
bb5e9339 | SebastianDiel | #include "../src/entity.h"
|
|
#include "../src/entitymanager.h"
|
|||
9d05e414 | Christian Ehringfeld | #include <QGenericReturnArgument>
|
|
81c23b56 | Christian Ehringfeld | /**
|
|
* create,remove und merge funktionieren
|
|||
*/
|
|||
9d05e414 | Christian Ehringfeld | int main(int argc, char *argv[]) {
|
|
bb5e9339 | SebastianDiel | Q_UNUSED(argc) Q_UNUSED(argv)
|
|
f53f7740 | Christian Ehringfeld | CuteEntityManager::EntityManager *e = new CuteEntityManager::EntityManager("QSQLITE",
|
|
QDir::currentPath() + "/db.sqlite");
|
|||
QSharedPointer<Artikel> a = QSharedPointer<Artikel>(new Artikel(20.0, "Müsli"));
|
|||
9c2f773f | Christian Ehringfeld | auto ep = a.dynamicCast<CuteEntityManager::Entity>();
|
|
qDebug() << e;
|
|||
qDebug() << "Tabelle artikel erstellt:" << e->createTable(ep);
|
|||
d568923d | Christian Ehringfeld | e->create(ep);
|
|
81c23b56 | Christian Ehringfeld | ||
a205e8a9 | Christian Ehringfeld | QSharedPointer<CuteEntityManager::Entity> p = QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann", Person::MALE, "", "", "",
|
|
f53f7740 | Christian Ehringfeld | QDate::currentDate()));
|
|
auto pptr = p.dynamicCast<CuteEntityManager::Entity>();
|
|||
e->createTable(pptr);
|
|||
e->create(pptr);
|
|||
586bb527 | Christian Ehringfeld | ||
f53f7740 | Christian Ehringfeld | QSharedPointer<Group> grp = QSharedPointer<Group>(new Group());
|
|
e->createTable(grp.dynamicCast<CuteEntityManager::Entity>());
|
|||
grp.data()->setTeacher(new Person("Test", "Test12345"));
|
|||
grp.data()->setTeacherP(QSharedPointer<Person>(new Person("Max", "Mustermann")));
|
|||
81c23b56 | Christian Ehringfeld | return 0;
|
|
}
|