ObjectAdmin SqlOrderBy


Recently upgraded from 7.2.9 to 7.2.12 and one of our webtop pages unexpectedly changed. Traced the issue to the formtools/objectadmin.cfm file.

The invocation specified sqlorderby="myColumn" which previously acted as expected: sorted ASC. With the update and because of sanitisation, if the order is unspecified it now sorts DESC. This is unexpected as most popular SQL engines sort ASC when direction is not explicitly specified.

I have no idea of the best way forward. If changes we made so that SQL order by acts like a SQL sort, behaviour will change again. Perhaps the suggestion should be to always explicitly state sort direction?

On a side note, the sanitizeSQLOrderBy function (https://github.com/farcrycore/core/blob/master/tags/formtools/objectadmin.cfm#L1275-L1289) looks like it could result in unexpected behaviour for complex SQL order by (columnA DESC, columnB DESC). Am I wrong? Is it expected?


1 Like