Ordering entities

Forum for posting problems using QxOrm library

Ordering entities

Postby mdw » Mon Apr 16, 2018 8:44 am

QxORM offers two types of methods to sort columns: orderByAsc() and orderByDesc(). Unfortunately at least with SQLite you are not able to mix them since the ORDER BY SQL clause is generated twice.

e.g. query.OrderAsc(id).OrderDesc(Name) generates ORDER BY id ASC ORDER BY Name DESC.
mdw
 
Posts: 34
Joined: Mon Feb 15, 2016 2:45 pm

Re: Ordering entities

Postby qxorm » Mon Apr 16, 2018 1:09 pm

Hello,

You can resolve this issue using the qx::QxSqlQuery::freeText() method (instead of OrderAsc or OrderDesc).

Example :
Code: Select all
query.freeText("ORDER BY XXXXXXXXX");
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Ordering entities

Postby mdw » Tue Apr 17, 2018 7:45 am

Yeah, I am using this work-around already 8-).
mdw
 
Posts: 34
Joined: Mon Feb 15, 2016 2:45 pm


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron