silverstripe/silverstripe-cms — pull request #802 by tractorcow (2013-07-22 22:41:13+00:00)
Title: BUG Fixed up SQL table.column identifiers, SQL encoding issue

The benefit from these changes mean that SQL is now better formed, more closely aligned to Silverstripe conventions (queried columns are now in "Table"."Column" format). This also assists with extensions that need to do SQL augmentation on certain tables, as now the queried table is visible in the select fragment of the query.

Certain where conditions have been tidied up with ->format instead of ->where in order to promote better SQL security.

Changes to DataObject::get_one (with caching specified as an option) have been restricted to prevent the benefit from cached results being lost.

I didn't bother to update the direct SQLQuery instances since those queries can't be augmented (only via DataQuery) and are pretty rigid anyway.

There was a bug in CMSPageAddController::doAdd where a string was raw2sql encoded prior to being passed into SiteTree::get_by_link (which was subsequently raw2sql encoding it again).