[Qt-interest] RFC : QDjango, a Qt-based C++ ORM

Jeremy Lainé jeremy.laine at bolloretelecom.eu
Thu Jun 3 18:42:44 CEST 2010


Hello,

I have been working on an opensource (LGPL) ORM for Qt with the following design goals:

* tight integration with Qt's Meta Object System, to be able to simply declare database 
fields in models using Q_PROPERTY

* the ability to create database tables automatically from the model declaration

* a robust queryset API, with the ability to express complex WHERE clauses using C++'s 
"&&" and "||" operators, and with lazy querysets (i.e. you only hit the database once you 
start reading results)

* (optional) integration with QtScript, so that you can access your models from QtScript

I have drawn extensive inspiration from Django's [1] python ORM API, which is why the 
project's name is "QDjango" (unless someone suggests a better name!).

The basics are all in place, it is possible to declare models, create database tables, and 
perform queries. So far I have tested QDjango against the QSQLITE and QMYSQL plugins, 
though support for additional database types should not be hard. I have added a full test 
suite to QDjango to ease this task.

QtScript support is not yet complete, but I have added a basic "qdjango-console" command 
line tool which gives you an interactive prompt to interact with database models (see 
tests/main.js for an example). Loading additional models can be achieved using QtScript 
plugins.

In order to make this ORM as usefull as possible to the community, I would very much 
welcome comments on the API, or use cases which you feel are note addressed. On the 
project homepage [2] you can find the source code, examples and API documentation [3].

I look forward to hearing from you!

Jeremy

[1] http://www.djangoproject.com/
[2] http://opensource.bolloretelecom.eu/projects/qdjango/
[3] http://opensource.bolloretelecom.eu/doxygen/qdjango/



More information about the Qt-interest-old mailing list