We're updating the issue view to help you get more done.Learn more

Datamanager list view table: fails when sorting with MSSQL

With the MSSQL adapter, sorting tables in dataManagers listView fails, due to an error in the generated SQL Query.

Explenation:
The display of a data page in listView consists out of two queries. On for the data and one for the number of found records.
The query for the number of found records is wrong:

1 2 3 select count(1) as [record_count] from ( select articles.title,...) where articles.title like '%searchterm%' order by [articles].[title] asc ) [original_statement]

the order by attribute is not allowed in MSSQL.

the fix/workaround is quite easy. In 'PresideObjectService.selectData()' (line 211), the argument 'recordCountOnly' can be evaluated:

1 2 3 4 5 if ( arguments.recordCountOnly ) { args.orderBy = ""; } else { args.orderBy = _parseOrderBy( args.orderBy, args.objectName, args.adapter ); }

This change fixes the sorting issue but is also a perfomance improvement for all places where the recordcount is shown. Not only for MSSQL, also for all other databases.

Status

Assignee

Unassigned

Reporter

Michael Hnat

Labels

Accepted

Yes

Fix versions

Priority

High