Consider the following code
var query = "SELECT booksid FROM books WHERE ti ILIKE 'co%' ORDER BY ti";
controller.loadRecords(query,null);
application.output(query);
application.output(databaseManager.getSQL(foundset));
Loads the records fine, in the correct order, but my log shows:
SELECT booksid FROM books WHERE ti ILIKE 'co%' ORDER BY ti
select booksid from books where booksid in (SELECT booksid FROM books WHERE ti ILIKE 'co%' ) order by booksid asc
The records are shown on screen sorted by ti, but databaseManager.getSQL(foundset) has lost my ORDER BY clause and added its own. Which means you can’t use it restore records in the correct order. The form does not have an initial sort.
Also
select booksid from books where booksid in (SELECT booksid FROM …
Looks inefficient and unnecessary to me.
PostgreSQL 8.2.4 And Servoy 3.5.1 on Mac OS X.