Uploaded image for project: 'PresideCMS'
  1. PRESIDECMS-727

Datamanager list view table: fails when sorting with MSSQL

    Details

    • Type: Improvement
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 10.8.0
    • Labels:
    • Sprint:
    • Accepted:
      Yes

      Description

      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:

      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:

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              madmikede Michael Hnat
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: