[icinga-checkins] icinga.org: icinga-api/master: * Added support for 'not like' filter

git at icinga.org git at icinga.org
Thu Sep 9 12:08:42 CEST 2010


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

Author: jmosshammer <jmosshammer at ws-jmosshammer.(none)>
Date:   Thu Sep  9 12:09:02 2010 +0200

* Added support for 'not like' filter

---

 objects/IcingaApiConstantsInterface.php            |    1 +
 objects/search/filter/IcingaApiSearchFilterIdo.php |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/objects/IcingaApiConstantsInterface.php b/objects/IcingaApiConstantsInterface.php
index cdd10a2..f3336d8 100644
--- a/objects/IcingaApiConstantsInterface.php
+++ b/objects/IcingaApiConstantsInterface.php
@@ -69,6 +69,7 @@ interface IcingaApiConstantsInterface {
 	const MATCH_EXACT = '=';
 	const MATCH_NOT_EQUAL = '!=';
 	const MATCH_LIKE = 'like';
+	const MATCH_NOT_LIKE = 'not like';
 	const MATCH_GREATER_THAN = '>';
 	const MATCH_GREATER_OR_EQUAL = '>=';
 	const MATCH_LESS_THAN = '<';
diff --git a/objects/search/filter/IcingaApiSearchFilterIdo.php b/objects/search/filter/IcingaApiSearchFilterIdo.php
index 878e44e..22c8288 100644
--- a/objects/search/filter/IcingaApiSearchFilterIdo.php
+++ b/objects/search/filter/IcingaApiSearchFilterIdo.php
@@ -8,7 +8,7 @@ class IcingaApiSearchFilterIdo extends IcingaApiSearchFilter {
 		$field = $this->getField();
 		$value = $this->getValue();
 		$match = $this->getMatch();
-		if($match == IcingaApi::MATCH_LIKE)
+		if($match == IcingaApi::MATCH_LIKE || $match == IcingaApi::MATCH_NOT_LIKE)
 			$value = str_replace("*","%",$value);
 		
 		$statementSkeleton = $field." ".$match." '".$value."' ";





More information about the icinga-checkins mailing list