From f305a334d5ad2c293f984e77f8a98a6332ed4ebc Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 19 May 2015 09:48:20 +0200 Subject: [PATCH] DbConnection: Drop param $columnIndex in fetchColumn(), it's unused --- library/Icinga/Data/Db/DbConnection.php | 5 ++--- library/Icinga/Data/Fetchable.php | 6 ++---- library/Icinga/Data/SimpleQuery.php | 8 +++----- library/Icinga/Repository/RepositoryQuery.php | 10 ++++------ .../library/Monitoring/DataView/DataView.php | 8 +++----- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/library/Icinga/Data/Db/DbConnection.php b/library/Icinga/Data/Db/DbConnection.php index 6167a23db..a7f933f88 100644 --- a/library/Icinga/Data/Db/DbConnection.php +++ b/library/Icinga/Data/Db/DbConnection.php @@ -248,14 +248,13 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible } /** - * Fetch a column of all rows of the result set as an array + * Fetch the first column of all rows of the result set as an array * * @param DbQuery $query - * @param int $columnIndex Index of the column to fetch * * @return array */ - public function fetchColumn(DbQuery $query, $columnIndex = 0) + public function fetchColumn(DbQuery $query) { return $this->dbAdapter->fetchCol($query->getSelectQuery()); } diff --git a/library/Icinga/Data/Fetchable.php b/library/Icinga/Data/Fetchable.php index 0992be933..17ab7c359 100644 --- a/library/Icinga/Data/Fetchable.php +++ b/library/Icinga/Data/Fetchable.php @@ -23,13 +23,11 @@ interface Fetchable public function fetchRow(); /** - * Fetch a column of all rows of the result set as an array - * - * @param int $columnIndex Index of the column to fetch + * Fetch the first column of all rows of the result set as an array * * @return array */ - public function fetchColumn($columnIndex = 0); + public function fetchColumn(); /** * Fetch the first column of the first row of the result set diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index dd0a80d04..7dec095d2 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -437,16 +437,14 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator } /** - * Fetch a column of all rows of the result set as an array - * - * @param int $columnIndex Index of the column to fetch + * Fetch the first column of all rows of the result set as an array * * @return array */ - public function fetchColumn($columnIndex = 0) + public function fetchColumn() { Benchmark::measure('Fetching one column started'); - $values = $this->ds->fetchColumn($this, $columnIndex); + $values = $this->ds->fetchColumn($this); Benchmark::measure('Fetching one column finished'); return $values; } diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index 91988605c..8a86829fd 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -420,23 +420,21 @@ class RepositoryQuery implements QueryInterface, Iterator } /** - * Fetch and return a column of all rows of the result set as an array - * - * @param int $columnIndex Index of the column to fetch + * Fetch and return the first column of all rows of the result set as an array * * @return array */ - public function fetchColumn($columnIndex = 0) + public function fetchColumn() { if (! $this->hasOrder()) { $this->order(); } - $results = $this->query->fetchColumn($columnIndex); + $results = $this->query->fetchColumn(); if ($this->repository->providesValueConversion()) { $columns = $this->getColumns(); $aliases = array_keys($columns); - $column = is_int($aliases[$columnIndex]) ? $columns[$columnIndex] : $aliases[$columnIndex]; + $column = is_int($aliases[0]) ? $columns[0] : $aliases[0]; foreach ($results as & $value) { $value = $this->repository->retrieveColumn($column, $value); } diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index 442e1e7c2..a5d8fffe2 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -490,15 +490,13 @@ abstract class DataView implements QueryInterface, IteratorAggregate } /** - * Fetch a column of all rows of the result set as an array - * - * @param int $columnIndex Index of the column to fetch + * Fetch the first column of all rows of the result set as an array * * @return array */ - public function fetchColumn($columnIndex = 0) + public function fetchColumn() { - return $this->getQuery()->fetchColumn($columnIndex); + return $this->getQuery()->fetchColumn(); } /**