This commit is contained in:
Hamed Masafi 2018-01-08 20:44:50 +03:30
parent 01614a2b3c
commit d0fb2803b8
3 changed files with 11 additions and 7 deletions

View File

@ -84,6 +84,10 @@ public: \
NUT_WRAP_NAMESPACE(TableSet)<type*> *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)

View File

@ -62,15 +62,15 @@ public:
template<class T>
Q_OUTOFLINE_TEMPLATE TableSet<T>::TableSet(Database *parent) : TableSetBase(parent)
{
auto t = new QMetaType(qRegisterMetaType<T>());
_childClassName = t->metaObject()->className();
// auto t = new QMetaType(qRegisterMetaType<T>());
// _childClassName = t->metaObject()->className();
}
template<class T>
Q_OUTOFLINE_TEMPLATE TableSet<T>::TableSet(Table *parent) : TableSetBase(parent)
{
auto t = new QMetaType(qRegisterMetaType<T>());
_childClassName = t->metaObject()->className();
// auto t = new QMetaType(qRegisterMetaType<T>());
// _childClassName = t->metaObject()->className();
}
template<class T>

View File

@ -16,12 +16,12 @@
MainTest::MainTest(QObject *parent) : QObject(parent)
{
}
void MainTest::initTestCase()
{
qDebug() << "User type id:" << qRegisterMetaType<Post*>();
qDebug() << "User type id:" << qRegisterMetaType<User*>();
qDebug() << "Post type id:" << qRegisterMetaType<Post*>();
qDebug() << "Comment type id:" << qRegisterMetaType<Comment*>();
qDebug() << "DB type id:" << qRegisterMetaType<WeblogDatabase*>();
@ -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);