MINOR: neatly quote identifiers

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@109405 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andreas Piening 2010-08-15 23:04:30 +00:00 committed by Sam Minnee
parent 801e3c958c
commit 0226781e37

View File

@ -241,14 +241,14 @@ class SQLQuery {
foreach($lumpedSortParts as $i => $sortPart) {
$sortPart = trim($sortPart);
if(substr(strtolower($sortPart),-5) == ' desc') {
$this->select[] = substr($sortPart,0,-5) . " AS _SortColumn{$i}";
$newSorts[] = "_SortColumn{$i} DESC";
$this->select[] = substr($sortPart,0,-5) . " AS \"_SortColumn{$i}\"";
$newSorts[] = "\"_SortColumn{$i}\" DESC";
} else if(substr(strtolower($sortPart),-4) == ' asc') {
$this->select[] = substr($sortPart,0,-4) . " AS _SortColumn{$i}";
$newSorts[] = "_SortColumn{$i} ASC";
$this->select[] = substr($sortPart,0,-4) . " AS \"_SortColumn{$i}\"";
$newSorts[] = "\"_SortColumn{$i}\" ASC";
} else {
$this->select[] = "$sortPart AS _SortColumn{$i}";
$newSorts[] = "_SortColumn{$i} ASC";
$this->select[] = "$sortPart AS \"_SortColumn{$i}\"";
$newSorts[] = "\"_SortColumn{$i}\" ASC";
}
}