Page 1 of 1

Help with qx_query::freeText

PostPosted: Fri May 04, 2012 8:51 am
by andigor
I need to generate such SQL condition - WHERE FLOOR(column_name/100) = number

How can I use qx_query::freeText for this?

Re: Help with qx_query::freeText

PostPosted: Fri May 04, 2012 1:21 pm
by QxOrm admin
I need to generate such SQL condition - WHERE FLOOR(column_name/100) = number
How can I use qx_query::freeText for this?

No need to use qx_query::freeText for that !
You can construct your query directly :
Code: Select all
qx_query query("WHERE FLOOR(column_name/100) = :number");
query.bind(":number", myValue);
// etc...

qx::QxSqlQuery::freeText method must be used only if you start to build your query using C++ style (because you can't mix C++ style and direct SQL string).

You can also try something like this if you prefer, but I'm not sure it will work :
Code: Select all
qx_query query = qx_query().where("FLOOR(column_name/100)").isEqualTo(myValue);


Note : for more details about qx_query class, goto the FAQ of QxOrm library :
http://www.qxorm.com/qxorm_en/faq.html#faq_210