Results 1 to 5 of 5

Thread: DQuest - ORM framework for Qt/Sqlite

  1. #1
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default DQuest - ORM framework for Qt/Sqlite

    Hi all,

    I would like to share my new OSS project for Qt and mobile to you. It is DQuest , a C++ ORM (Object-relational mapping) for Qt framework. It aims to provide a rapid development environment for application with database access. The database model declaration is very simple , just like other C++/Qt class. It is designed for mobile environment but also useful for desktop and embedded application that do not demand for maximized performance for database.

    It is getting more number of application use Sqlite for their data storage. However, writing data model in SQL is complicated . Usually it need to write two set of interface : One for C/C++ and other for Sql. The work load is duplicated, and debug is troublesome.

    With DQuest, you can declare a database model using C++ directly. Read / write access can be made through the C++ interface. You won't need to wbrite any SQL to gain the benefit of using Sqlite in your application.

    To declare your database model, you need to:

    * Create a class that inherits DQModel
    * Added a DQ_MODEL macro to the class declaration
    * Design your database field by using DQField template type
    * Register your model with DQ_DECLARE_MODEL macro function.

    Example:
    Qt Code:
    1. #include <dqmodel.h>
    2.  
    3. /// User account database
    4. class User : public DQModel {
    5. DQ_MODEL
    6. public:
    7. DQField<QString> userId;
    8. DQField<QDateTime> creationDate;
    9. DQField<qreal> karma;
    10. };
    11.  
    12. /// Declare the model and the field clause
    13. DQ_DECLARE_MODEL(User,
    14. "user", // the table name.
    15. DQ_FIELD(userId , DQNotNull | DQUnique),
    16. DQ_FIELD(creationDate , DQDefault("CURRENT_TIMESTAMP") ),
    17. DQ_FIELD(karma)
    18. );
    To copy to clipboard, switch view to plain text mode 

    The declaration is equivalent to make this SQL table for SQLITE

    Qt Code:
    1. CREATE TABLE user (
    2. id INTEGER PRIMARY KEY AUTOINCREMENT,
    3. userId TEXT NOT NULL UNIQUE,
    4. creationDate DATETIME DEFAULT CURRENT_TIMESTAMP ,
    5. karma DOUBLE
    6. );
    To copy to clipboard, switch view to plain text mode 

    Remarks: QObject is rarely used in DQuest , and DQModel is not QObject-based.

    Features
    • Database model declaration and registration is simple.
      • Declare model in C++/Qt way (p.s QObject is not used)
      • Support model inheritance
      • Foreign key - auto load entry
    • Supported operations : create table , drop table , select , delete , insert , query the existence of table , ...
    • Support Sqlite - usable on mobile platform
    • Open source (New BSD license)


    Pending features

    Multiple database access
    • The software design support to access multiple database , but it is not tested.

    Multi-threading
    • The software design support multi-threading , but it is not tested.


    Limitations
    • DQuest is still in alpha stage. Use at your own risk.
    • Not all SQL statement and options are implemented , most of them can be added upon on user request. Please join the mailing list.
    • Not implemented operations : create trigger , create index
    • Not supported operations : join select

    Licensing

    DQuest source code is licensed under BSD license. You may use it for open source and closed source application , you just need to obey the requirement of BSD (e.g distribute the license agreement). Moreover, if you can inform us that your application is using DQuest. It can encourage developer to further develop the software.



    Links:
    Last edited by benlau; 6th October 2010 at 17:46.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DQuest - ORM framework for Qt/Sqlite

    Quote Originally Posted by benlau View Post
    Remarks: DQModel is not QObject based, (QObject is rarely used in DQuest) , therefore you don't need to write setter/getter for each database field.
    I don't understand this sentence. Would you explain why if a class is not based on QObject you don't need setter/getter methods?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: DQuest - ORM framework for Qt/Sqlite

    When I talk this project to friend , he think that I am using QObject/moc to implement ,and use the Q_PROPERTY to declare field , then it can get the field list from meta object.

    But in fact it do not use QObject . QObject require a setter /getter for each field , but DQuest do not have that requirement. So I just want to clarify it.

    Anyway , I think this statement is confusing. I will remove it.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DQuest - ORM framework for Qt/Sqlite

    No, QObject doesn't require a getter and setter method for each field. Don't confuse fields and properties - you can have a field without it being a property and you can have a property without it being a physical field in a class. And you can have a read-only property that only needs a getter but not a setter.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: DQuest - ORM framework for Qt/Sqlite

    I mean he think it use property to declare database "field" , not talking about member variable / attribute. I think every C++ programmer won't mix up the concept , so didn't verified the wording before send.

Similar Threads

  1. CAD GUI Framework
    By qtoptus in forum Qt-based Software
    Replies: 9
    Last Post: 4th October 2010, 13:06
  2. [Qt][SQLite] Two problems with SQLite.
    By Xandareva in forum Newbie
    Replies: 6
    Last Post: 6th April 2010, 23:06
  3. Animation Framework?
    By TheJim01 in forum Newbie
    Replies: 2
    Last Post: 10th February 2010, 17:54
  4. Qt 4 Reporting framework
    By ZeroCost in forum Qt Programming
    Replies: 2
    Last Post: 25th July 2007, 21:47
  5. Problem with MDI framework
    By a_m_mukul in forum Qt Programming
    Replies: 7
    Last Post: 6th July 2007, 22:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.