Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 79bcb404

Von Christian Ehringfeld vor etwa 9 Jahren hinzugefügt

  • ID 79bcb404334c5daf03e3afd33d8f79e21fd42888
  • Vorgänger e332a521
  • Nachfolger 11f5a3a7

Samples update

Unterschiede anzeigen:

samples/example/main.cpp
Q_UNUSED(argc) Q_UNUSED(argv)
QTime t;
t.start();
CuteEntityManager::EntityManager *e = new
// CuteEntityManager::EntityManager("QSQLITE",
// QDir::currentPath() + "/db.sqlite", "", "", "", 0, true);
CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON");
qDebug() << "EntityManagerObjectName:" << e->objectName();
SqliteBackupProcessor *sqliteproc = new SqliteBackupProcessor(e->getDb(),
QDir::currentPath());
qWarning() << "DB Loaded:" << sqliteproc->sqliteDBMemFile(false, "db.sqlite");
/**
* @brief EntityInstanceFactory::registerClass<EntityClass>
* You must register every EntityClass, cause Qt is not creating all meta object informations for entity manager
......
EntityInstanceFactory::registerClass<Pupil>();
EntityInstanceFactory::registerClass<Contact>();
EntityInstanceFactory::registerClass<Address>();
CuteEntityManager::EntityManager *e = new
// CuteEntityManager::EntityManager("QSQLITE",
// QDir::currentPath() + "/db.sqlite", "", "", "", 0, true);
CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON");
qDebug() << "EntityManagerObjectName:" << e->objectName();
SqliteBackupProcessor *sqliteproc = new SqliteBackupProcessor(e->getDb(),
QDir::currentPath());
qWarning() << "DB Loaded:" << sqliteproc->sqliteDBMemFile(false, "db.sqlite");
QThread *entityManager = new QThread();
e->moveToThread(entityManager);
qWarning() << "-----------------------------";
samples/validators/main.cpp
using namespace CuteEntityManager;
int main(int argc, char *argv[]) {
Q_UNUSED(argc) Q_UNUSED(argv)
CuteEntityManager::EntityManager *e = new
CuteEntityManager::EntityManager("QSQLITE", QDir::currentPath() + "/db.sqlite");
EntityInstanceFactory::registerClass<Person>();
EntityInstanceFactory::registerClass<Address>();
CuteEntityManager::EntityManager *e = new
CuteEntityManager::EntityManager("QSQLITE", QDir::currentPath() + "/db.sqlite");
e->createTable("Person");
e->createTable("Address");
/**
......
QSharedPointer<Entity> p1 = QSharedPointer<Person>(new Person("Thomas", "B",
Person::Gender::MALE, "", QString(), QString(), QDate(), 0));
QSharedPointer<Entity> p2 = QSharedPointer<Person>(new Person("Teresa", "Conrad",
Person::Gender::FEMALE, "", QString(), QString(), QDate(2016, 7, 13), 0));
QSharedPointer<Entity> p2 = QSharedPointer<Person>(new Person("Teresa",
"Conrad",
Person::Gender::FEMALE, "", QString(), QString(), QDate(2016, 7, 13), 0));
QSharedPointer<Entity> p3 = QSharedPointer<Person>(new Person("Heinz", "Dunst",
Person::Gender::MALE, "", QString(), QString(), QDate(1972, 7, 13), 0));

Auch abrufbar als: Unified diff