-
Notifications
You must be signed in to change notification settings - Fork 75
Using queries
Hamed Masafi edited this page Jul 26, 2017
·
8 revisions
auto q = db.posts().query();
You can also create query in one command:
auto q = db.posts().query()
->setWhete(Post::idField() == 1)
->toList();
Now q contains QList<Post>* and can be used in code. query has other commands like: sum, avg, max, min and etc
auto post = db.posts().query()
->setWhete(Post::idField() == 1)
->first();
if(post)
qDebug() << "Post found in database";
else
qDebug() << "No post found!";
auto post = db.posts().query()
->setWhete(Post::idField().in(QList<int>() << 1 << 2 << 3 << 4) || Post::isAccepted())
->first();
Table of contents