[Development] Request moving project to playground area

Hamed Masafi hamed.masafi at gmail.com
Wed Jan 27 17:04:24 CET 2021


Sorry about pursuing an old thread. but I want to know what you think of
this old proposal.

Over the years, Nott has had many improvements:
- Macro mechanisms are removed and what remains is much like writing a
normal classroom.
- Many of the problems that have been resolved and used for our company's
projects.
- Tested with different compilers and database engines

It's easier to create a table in the table now and just add a few macro to
the class.

A sample Table class:

#ifndef SAMPLETABLE_H

#define SAMPLETABLE_H


#include <QtNut/table.h>


class SampleTable : public Nut::Table

{

    Q_OBJECT

    Q_PROPERTY(int id READ id WRITE setId NOTIFY idChanged)

    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)

    Q_PROPERTY(QString lastName READ lastName WRITE setLastName NOTIFY
lastNameChanged)


    int m_id;

    QString m_name;

    QString m_lastName;


    NUT_PRIMARY_KEY(id)

    NUT_FIELD(int, id)

    NUT_FIELD(QString, name)

    NUT_FIELD(QString, lastName)


public:

    explicit SampleTable(QObject *parent = nullptr);


    int id() const;

    QString name() const;

    QString lastName() const;


public slots:

    void setId(int id);

    void setName(QString name);

    void setLastName(QString lastName);


signals:

    void idChanged(int id);

    void nameChanged(QString name);

    void lastNameChanged(QString lastName);

};


#endif // SAMPLETABLE_H


As you can see the Qt's property mechanism was used without changing in
class definition

in order to compare with the other competitors:
odb:
There's no need for a separate compiler, and the prerequisites are just کیوت
.
Odb's license prevent to publish closed source roduct
QxORM:
doesn't need separate tools
QDjango:
Doesn't require a hard code

Sample usage of nut with below sample Table:
Insert into the database:

auto s = new SampleTable;

s->setName("hamed");

s->setLastName("masafi");

db.items()->append(s);

auto c = db.saveChanges(); // returns count of affected rows

QCOMPARE(c, 1);


Retrieve from database:
auto item = db.items()->query()

    .where(SampleTable::nameField() == "hamed" &&
SampleTable::lastNameField() == "masafi")

    .first();


auto item = db.items()->query()

    .where(SampleTable::nameField().like("%h%"))

    .skip(10)

    .take(10)

    .first();

Of course, the library facilities are not limited to these examples and
include different types of inquiry. And it's also possible to update and
record the records without fetching from database and some other facilities
In new versions, Nut is a Qt module (checkout dev branch of github repo)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210127/1ac4cb58/attachment-0001.html>


More information about the Development mailing list