Page 1 of 1

Postgres JSON (BSON) fields

PostPosted: Tue Feb 17, 2015 8:18 am
by zawisza
Hi!

I'm wondering if I can use postgresql json fields operators ( http://www.postgresql.org/docs/9.4/stat ... -json.html ) in search queries, in QxORM library? I didn't see any example of doing such a thing, is it possible?
And what about postgres table inharitance?

Re: Postgres JSON (BSON) fields

PostPosted: Thu Feb 19, 2015 2:52 pm
by qxorm
Hello,

To build queries, QxOrm library provides the qx::QxSqlQuery class (or its qx_query alias) : http://www.qxorm.com/doxygen/html/class ... query.html
There is a FAQ here : http://www.qxorm.com/qxorm_en/faq.html#faq_210
If you want to use a special feature provided by your SGBD (like JSON for example), you can use the freeText() method of qx::QxSqlQuery class.

Or you can also write your SQL query manually and use qx::dao::call_query() or qx::dao::execute_query() functions.
You can also use directly the QtSql module if you prefer because QxOrm library is based on QtSql.

About PostgreSQL table inheritance, I would recommend to :
1- define your tables with pgAdmin or another tool ;
2- donwload and execute QxEntityEditor application ;
3- try the QxEntityEditor import plugin to load your tables into a QxEntityEditor project ;
4- then you can export it to a C++/Qt project, and see how classes are mapped to the inherited tables.