I have an issue connecting to the repository (either because of our proxy or Windows) so instead am posting a couple of bug fixes here.

The first bug is with the DBMSSQL::applyLimit function. It’s doesn’t check for SELECT modifiers and as such will generate invalid SQL when a SELECT modifier
is present. I have provided a quick and dirty fix for this, I suggest someone should rewrite it but the code I have provided works.

The second bug I found with the same DBMSSQL::applyLimit function but it may appear elsewhere. The DBMSSQL::applyLimit function converts the SQL query into a
sub-query to get around Microsoft SQL Server’s lack of an OFFSET function. The resulting SQL will fail (ambiguous column name) if two or more tables are joined, have columns with the same name and one or more of those columns is in the ORDER BY statement.
To get around this bug, I updated the Criteria class to automatically alias columns when required. I have modified Criteria so that is caches column names, similar to Criteria ::selectColumns except that the table name is removed and the number of times the
column name has been used is stored as the value. Criteria::addSelectColumn checks if the column name has been used before and if so adds an alias to the table name. This is a pretty big change to Criteria so you may wish to either ignore my change, suggest
another workaround, or call it a “auto-aliasing” feature and milk it for all it’s worth.

Chris Petersen

The information in this email is confidential and may be privileged or subject to copyright. It is intended for the exclusive use of the addressee(s). If you are not an addressee, please do not copy, distribute or otherwise
act on the email. If you have received the email in error, please contact the sender immediately and delete the email. The unauthorised use of this email may result in liability for breach of confidentiality, privilege or copyright.