From d0fb2803b8ece5166e0b02e5f0b287b70b616d8d Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 20:44:50 +0330 Subject: [PATCH] 3 --- src/defines.h | 4 ++++ src/tableset.h | 8 ++++---- test/basic/maintest.cpp | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/defines.h b/src/defines.h index 15921b5..fc17d57 100644 --- a/src/defines.h +++ b/src/defines.h @@ -84,6 +84,10 @@ public: \ NUT_WRAP_NAMESPACE(TableSet) *n(){ \ return m_##n; \ } +//static type *n##Table(){ \ +// /*static type *f = new type();*/ \ +// /*return f;*/ \ +//} \ #define NUT_INDEX(name, field, order) #define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) diff --git a/src/tableset.h b/src/tableset.h index e51cd10..e567ede 100644 --- a/src/tableset.h +++ b/src/tableset.h @@ -62,15 +62,15 @@ public: template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Database *parent) : TableSetBase(parent) { - auto t = new QMetaType(qRegisterMetaType()); - _childClassName = t->metaObject()->className(); +// auto t = new QMetaType(qRegisterMetaType()); +// _childClassName = t->metaObject()->className(); } template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Table *parent) : TableSetBase(parent) { - auto t = new QMetaType(qRegisterMetaType()); - _childClassName = t->metaObject()->className(); +// auto t = new QMetaType(qRegisterMetaType()); +// _childClassName = t->metaObject()->className(); } template diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5558843..366f805 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -16,12 +16,12 @@ MainTest::MainTest(QObject *parent) : QObject(parent) { - } void MainTest::initTestCase() { - qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "Post type id:" << qRegisterMetaType(); qDebug() << "Comment type id:" << qRegisterMetaType(); qDebug() << "DB type id:" << qRegisterMetaType(); @@ -96,7 +96,7 @@ void MainTest::createPost2() void MainTest::selectPosts() { auto q = db.posts()->query(); - q->join(Post::commentsTable()); +// q->join(Post::commentsTable()); q->orderBy(!Post::saveDateField() & Post::bodyField()); q->setWhere(Post::idField() == postId);