MINOR FIX: columns quoted properly

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86508 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2009-09-17 00:06:12 +00:00
parent 05c17d6f91
commit 9ec8c5c310

View File

@ -335,7 +335,7 @@ class Translatable extends DataObjectDecorator {
$translationGroupID = $this->getTranslationGroup(); $translationGroupID = $this->getTranslationGroup();
if(is_numeric($translationGroupID)) { if(is_numeric($translationGroupID)) {
$query = new SQLQuery( $query = new SQLQuery(
'DISTINCT Locale', 'DISTINCT "Locale"',
sprintf( sprintf(
'"%s" LEFT JOIN "%s" ON "%s"."OriginalID" = "%s"."ID"', '"%s" LEFT JOIN "%s" ON "%s"."OriginalID" = "%s"."ID"',
$baseDataClass, $baseDataClass,
@ -1133,7 +1133,10 @@ class Translatable extends DataObjectDecorator {
*/ */
static function get_existing_content_languages($className = 'SiteTree', $where = '') { static function get_existing_content_languages($className = 'SiteTree', $where = '') {
$baseTable = ClassInfo::baseDataClass($className); $baseTable = ClassInfo::baseDataClass($className);
$query = new SQLQuery('Distinct Locale',$baseTable,$where,"",'Locale'); //We don't quote $where if it is empty:
if($where!='')
$where="\"$where\"";
$query = new SQLQuery("Distinct \"Locale\"","\"$baseTable\"",$where, '', "\"Locale\"");
$dbLangs = $query->execute()->column(); $dbLangs = $query->execute()->column();
$langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs); $langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs);
$returnMap = array(); $returnMap = array();