From 4614ae64494ef3882918611bcf4805f18d2ce18a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 6 Nov 2010 22:36:22 +1300 Subject: [PATCH] Do old TODO and remove it. Nice. --- inc/caldav-REPORT-calquery.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index b8d166d0..f011268a 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -289,14 +289,6 @@ if ( ! ($target_collection->IsCalendar() || $target_collection->IsSchedulingColl $params = array( ':path_match' => '^'.$target_collection->bound_from() ); } -/** -* @todo Once we are past DB version 1.2.1 we can change this query more radically. The best performance to -* date seems to be: -* SELECT caldav_data.*,calendar_item.* FROM collection JOIN calendar_item USING (collection_id,user_no) -* JOIN caldav_data USING (dav_id) WHERE collection.dav_name = '/user1/home/' -* AND caldav_data.caldav_type = 'VEVENT' ORDER BY caldav_data.user_no, caldav_data.dav_name; -*/ - if ( is_array($qry_filters) ) { dbg_log_array( "calquery", "qry_filters", $qry_filters, true ); $components = array(); @@ -318,8 +310,8 @@ if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { $where .= " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; } -$sql = 'SELECT * FROM collection INNER JOIN caldav_data USING(collection_id) INNER JOIN calendar_item USING(dav_id) '. $where; -if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; +$sql = 'SELECT caldav_data.*,calendar_item.* FROM collection INNER JOIN caldav_data USING(collection_id) INNER JOIN calendar_item USING(dav_id) '. $where; +if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY caldav_data.dav_id"; $qry = new AwlQuery( $sql, $params ); if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) { while( $calendar_object = $qry->Fetch() ) {