Go to file
blackdal c4f0c30b0f skip and take 2017-08-24 20:05:23 +04:30
doc wip: Database model moved to TableModel 2017-05-27 20:10:10 +04:30
include wip: Database model moved to TableModel 2017-05-27 20:10:10 +04:30
src skip and take 2017-08-24 20:05:23 +04:30
test #4 maintext refactored 2017-08-09 17:49:35 +04:30
.gitignore Initial commit 2016-03-09 11:05:49 +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 updated 2017-02-01 13:31:21 +03:30
nut.pri some improvment 2017-07-02 18:42:15 +04:30
nut.qdocconf order phrase completed 2016-06-05 16:52:26 +04:30

README.md

Nut

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.