Go to file
Hamed Masafi 244778eb50 rc 2018-03-11 16:43:13 +03:30
doc minor polish 2018-01-09 16:34:21 +03:30
include wip: phrases polish 2018-02-17 19:14:39 +03:30
src rc 2018-03-11 16:43:13 +03:30
test wherephrase removed [skip ci] 2018-02-26 20:01:51 +03:30
.gitignore Initial commit 2016-03-09 11:05:49 +03:30
.travis.yml travis yml error fix 2018-02-26 13:48:44 +03:30
Doxyfile readme changes 2016-06-10 12:44:31 +04:30
LICENSE Initial commit 2016-03-09 11:05:49 +03:30
README.md readme fix 2018-01-15 17:59:17 +03:30
appveyor.yml wip: phrases polish 2018-02-17 19:14:39 +03:30
nut.pri CONFIG += c++11 2018-02-25 18:47:49 +03:30
nut.pro CONFIG += c++11 in pro file 2018-02-25 19:03:51 +03:30
nut.qbs qbs file added 2018-01-08 12:38:23 +03:30
nut.qdocconf order phrase completed 2016-06-05 16:52:26 +04:30

README.md

Nut

Build result

Brancc name Icon
master Build Status
dev Build Status

Advanced, Powerful and easy to use ORM for Qt5

Features:

  • Easy to use
  • Support PosgtreSQL, MySQL, SQLite and Microsoft Sql Server
  • Automatically create and update database
  • IDE auto complete support, No hard-code nedded
  • Table join detect

Sample Codes

Read data from database:

auto q = db.posts()->createQuery();
q->setWhere(Post::idField() == postId);
auto posts = q->toList();
// now posts is a QList<Post*> contain all posts in
//  database that has id equal to postId variable
auto post = q->first();
// post is first row in database that its id is equal to postId

Adding to database:

Post *newPost = new Post;
newPost->setTitle("post title");

db.posts()->append(newPost);

for(int i = 0 ; i < 3; i++){
    Comment *comment = new Comment;
    comment->setMessage("comment #" + QString::number(i));

    newPost->comments()->append(comment);
}
db.saveChanges();

Modify database data:

auto q = db.posts()->createQuery();
q->setWhere(Post::idField() == postId);
Post *post = q->first();

if(post) {
    post->setTitle("new name");
    db.saveChanges();
} else {
    qWarning("No post found!");
}

For more information read Wiki.