Error using limit and offset

Error using limit and offset

Postby luizcapu » Wed 16 Oct 2013 15:44

Hi !

I need to use limit and offset in my query but it raises an exception when I call Query.Open. I'm using native TSQLConnection with native TSQLQuery from Delphi XE2 with devart postgresql driver.

I already tested the SQL without limit and offset statments and it works fine.

Any tips about this ?

Thank you
luizcapu
 
Posts: 3
Joined: Wed 16 Oct 2013 15:42

Re: Error using limit and offset

Postby luizcapu » Wed 16 Oct 2013 15:58

In time... the exception raised is 'List index out of bounds (-1)'
luizcapu
 
Posts: 3
Joined: Wed 16 Oct 2013 15:42

Re: Error using limit and offset

Postby luizcapu » Wed 16 Oct 2013 16:06

Some more informations about my tests:

Case 1) setting offset=1 --> works fine !
select * from table order by id limit 50 offset 1;

Case 2) removing order by --> works fine !
select * from table limit 50 offset 0;

Case 2) with order by and offset=0 --> raises 'List index out of bounds (-1)'
select * from table order by id limit 50 offset 0;

Please, someone can help me with this ?
luizcapu
 
Posts: 3
Joined: Wed 16 Oct 2013 15:42

Re: Error using limit and offset

Postby AlexP » Fri 18 Oct 2013 08:30

Hello,

This problem is due the behaviour of TClientDataSet, not our driver. To solve the problem, you should set the poRetainServerOrder option of TDataSetProvider:

Code: Select all
DataSetProvider1.Options := [poRetainServerOrder];
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35


Return to dbExpress driver for PostgreSQL