[icinga-checkins] icinga.org: icinga-api/cdoebler/default: * added column conversion for postgresql

git at icinga.org git at icinga.org
Thu Jan 21 11:08:31 CET 2010


Module: icinga-api
Branch: cdoebler/default
Commit: b292b04d9f7e323fd2cb6d99927ca1207ce47091
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=b292b04d9f7e323fd2cb6d99927ca1207ce47091

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Fri Jan 15 14:15:10 2010 +0100

* added column conversion for postgresql

---

 objects/search/IcingaApiSearchIdo.php              |   11 +++++++++++
 .../data_interfaces/IcingaApiSearchIdoPgsql.php    |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/objects/search/IcingaApiSearchIdo.php b/objects/search/IcingaApiSearchIdo.php
index 15a65eb..8b7ff53 100644
--- a/objects/search/IcingaApiSearchIdo.php
+++ b/objects/search/IcingaApiSearchIdo.php
@@ -208,10 +208,21 @@ class IcingaApiSearchIdo
 			$columns = array($columns);
 		}
 
+		if (array_key_exists('columnWrap', $this->ifSettings->statements)) {
+			$columnWrap = $this->ifSettings->statements['columnWrap'];
+		} else {
+			$columnWrap = false;
+		}
+
 		foreach ($columns as $currentColumn) {
 			if (($processedColumn = $this->getColumn($currentColumn)) !== false) {
 				array_push($this->resultColumnKeys, $currentColumn);
 				array_push($this->resultColumnsNoAliases, $processedColumn);
+
+				if ($columnWrap !== false) {
+					$currentColumn = sprintf($columnWrap, $currentColumn);
+				}
+
 				$processedColumn .= ' ' . $currentColumn;
 				array_push($this->resultColumns, $processedColumn);
 			}
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
index 319e04a..c562986 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
@@ -19,6 +19,7 @@ class IcingaApiSearchIdoPgsql
 	public $clearVariables = array();
 
 	public $statements = array (
+		'columnWrap'	=> '"%s"',
 		'fieldsSuffix'	=> false,
 		'group'			=> ' group by %s ',
 		'order'			=> ' order by ',





More information about the icinga-checkins mailing list