[icinga-checkins] icinga.org: icinga-api/master: * Order by will be ignored in COUNT requests now if no group by is given

git at icinga.org git at icinga.org
Mon Jul 26 16:53:17 CEST 2010


Module: icinga-api
Branch: master
Commit: 580bb62ddf5915caa318196c94a27376f7e30945
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=580bb62ddf5915caa318196c94a27376f7e30945

Author: jmosshammer <jmosshammer at ws-jmosshammer.(none)>
Date:   Mon Jul 26 16:52:57 2010 +0200

* Order by will be ignored in COUNT requests now if no group by is given

---

 objects/search/IcingaApiSearchIdo.php |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/objects/search/IcingaApiSearchIdo.php b/objects/search/IcingaApiSearchIdo.php
index 49eb6a4..16b2dde 100644
--- a/objects/search/IcingaApiSearchIdo.php
+++ b/objects/search/IcingaApiSearchIdo.php
@@ -444,16 +444,16 @@ class IcingaApiSearchIdo
 	}
 
 	public function searchValid() {
-		$order = $this->searchOrderColumns;
-		// the pgsql and oracle want some grouping here
-
 		if($this->searchType == IcingaApi::SEARCH_TYPE_COUNT) {
-			if(!empty($order)) {
-				$this->setSearchGroup(array_unique(array_merge($this->getSearchGroup(),$order)));
+			$order = $this->searchOrderColumns;
+			$groupby = $this->searchGroup;
+
+			if(!empty($order) && empty($groupby)) {
+				$this->searchOrder = array();
+				$this->searchOrderColumns = array();
 			}
-			// remove oracle arithmetic columns
-			$this->ifSettings->groupByCols = array();
 		}
+	
 		return parent::searchValid();
 	}
 	
@@ -472,7 +472,6 @@ class IcingaApiSearchIdo
 
 			// create base for query
 			$query = $this->ifSettings->queryMap[$this->searchTarget];
-
 			// add query fields
 			$query = $this->replaceQueryVariables($query, 'FIELDS');
 





More information about the icinga-checkins mailing list