removed order by from count(*) query as MaxDB dont order after columns not retrived

This commit is contained in:
Ralf Becker 2004-08-03 23:22:35 +00:00
parent ff1cf940cc
commit 8cbf049cb3

View File

@ -34,9 +34,12 @@
foreach($holiday as $name => $val) foreach($holiday as $name => $val)
{ {
if (!substr($name,0,4) == 'hol_') if (substr($name,0,4) != 'hol_')
{
if (!is_numeric($name))
{ {
$holiday['hol_'.$name] = $holiday[$name]; $holiday['hol_'.$name] = $holiday[$name];
}
unset($holiday[$name]); unset($holiday[$name]);
} }
} }
@ -127,7 +130,7 @@
} }
/* Private functions */ /* Private functions */
function _build_where($locales,$query='',$order='',$year=0) function _build_where($locales,$query='',$order='',$year=0,$add_order_by=True)
{ {
$querymethod = 'hol_locale'; $querymethod = 'hol_locale';
if (is_array($locales)) if (is_array($locales))
@ -146,8 +149,10 @@
{ {
$querymethod .= " AND (hol_occurence < 1900 OR hol_occurence = ".(int)$year.")"; $querymethod .= " AND (hol_occurence < 1900 OR hol_occurence = ".(int)$year.")";
} }
if ($add_order_by)
{
$querymethod .= ' ORDER BY '.(preg_match('/[a-zA-Z0-9_,]+/',$order) ? $order : 'hol_month_num,hol_mday'); $querymethod .= ' ORDER BY '.(preg_match('/[a-zA-Z0-9_,]+/',$order) ? $order : 'hol_month_num,hol_mday');
}
return $querymethod; return $querymethod;
} }
@ -173,7 +178,7 @@
function holiday_total($locale,$query='',$year=0) function holiday_total($locale,$query='',$year=0)
{ {
$where = $this->_build_where($locale,$query,'',$year); $where = $this->_build_where($locale,$query,'',$year,False);
if($this->debug) if($this->debug)
{ {