From 8d69277c5a0d73a50e1ea3e35fb0c6014a217b98 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 2 Mar 2006 07:09:52 +0000 Subject: [PATCH] - fixing the performance problem on MySQL 5 by using "JOIN xxx USING(cal_id)" instead of ", xxx WHERE xxx.cal_id=egw_cal.cal_id" - removing the distinkt to fix a MsSQL problem (no distinkt on text columns), double rows will be removed in the php-code anyway --- calendar/inc/class.socal.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.socal.inc.php b/calendar/inc/class.socal.inc.php index ed71902a02..041d420f56 100644 --- a/calendar/inc/class.socal.inc.php +++ b/calendar/inc/class.socal.inc.php @@ -333,14 +333,15 @@ class socal //_debug_array($where); if (is_numeric($offset)) // get the total too { - // we only select cal_table.cal_id (and not cal_table.*) to be able to use DISTINKT (MsSQL does not allow it for text-columns) + // we only select cal_table.cal_id (and not cal_table.*) to be able to use DISTINCT (eg. MsSQL does not allow it for text-columns) $this->db->select($this->cal_table,"DISTINCT $this->repeats_table.*,$this->cal_table.cal_id,cal_start,cal_end,cal_recur_date", $where,__LINE__,__FILE__,false,'',false,0, "JOIN $this->dates_table USING(cal_id) JOIN $this->user_table USING(cal_id) LEFT JOIN $this->repeats_table USING(cal_id)"); $this->total = $this->db->num_rows(); } - $this->db->select($this->cal_table,"$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date", + $this->db->select($this->cal_table,($this->db->capabilities['distinct_on_text'] ? 'DISTINCT ' : ''). + "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date", $where,__LINE__,__FILE__,$offset,'ORDER BY '.$order,false,$num_rows, "JOIN $this->dates_table USING(cal_id) JOIN $this->user_table USING(cal_id) LEFT JOIN $this->repeats_table USING(cal_id)");