Page 2 of 2

Re: Problems with ADS and ORDER BY

Posted: Fri Nov 27, 2020 10:45 am
by rdonnay
Order by with more than one fields and DESC don't works.
Are you saying that this works with the architect?

Do you get a syntax error or do you get no cursor?

I have run into problems like this with ADS in the past with some ORDER BY clauses that require both a free connection and a dictionary connection.

Look at this SqlQuery configuration:
Capture.JPG
Capture.JPG (71.53 KiB) Viewed 2329 times
Notice that there is an entry for "Server Free Table Directory:" This will create a 2nd Dac session that is a free table connection.
This is needed to open the temporary database that is created as the cursor.

Look at the _DCADS.PRG source code, CLASS DC_AdsStatement INLINE METHOD Execute.
You will see that it will use the free table connection to build the cursor from the temporary ADT file that is created.
I know this looks convuluted, but many months of working with 2 customers on issues like this required this solution in Xbase++.
I'm guessing that the architect handles this in a similar way.

You should try creating a 2nd DacSession that is a free table connection and assign the pointer to that connection to DC_AdsStatement:sessionFree.

When using SqlQuery, this is what your Sqlquery.ini file entry should look like:

[ADS_4]
Name=BHS (BhsTest.add)
UID=rcovington
Database=C:\bhs\bhstest.add
ServerFree=C:\bhs\
AdsLockingType=1