diff --git a/library/Icinga/Data/DataArray/Query.php b/library/Icinga/Data/DataArray/Query.php index 6b62a3295..2f4129e52 100644 --- a/library/Icinga/Data/DataArray/Query.php +++ b/library/Icinga/Data/DataArray/Query.php @@ -2,9 +2,9 @@ namespace Icinga\Data\DataArray; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; -class Query extends BaseQuery +class Query extends SimpleQuery { /** * Remember the last count diff --git a/library/Icinga/Data/Db/Connection.php b/library/Icinga/Data/Db/Connection.php index d8123e75d..8700aa3f8 100644 --- a/library/Icinga/Data/Db/Connection.php +++ b/library/Icinga/Data/Db/Connection.php @@ -33,7 +33,7 @@ use PDO; use Zend_Config; use Zend_Db; use Icinga\Application\Benchmark; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Data\Selectable; use Icinga\Exception\ConfigurationError; @@ -207,11 +207,11 @@ class Connection implements Selectable /** * Retrieve an array containing all rows of the result set * - * @param BaseQuery $query + * @param SimpleQuery $query * * @return array */ - public function fetchAll(BaseQuery $query) + public function fetchAll(SimpleQuery $query) { Benchmark::measure('DB is fetching All'); $result = $this->dbAdapter->fetchAll($query->getSelectQuery()); @@ -222,11 +222,11 @@ class Connection implements Selectable /** * Fetch the first row of the result set * - * @param BaseQuery $query + * @param SimpleQuery $query * * @return mixed */ - public function fetchRow(BaseQuery $query) + public function fetchRow(SimpleQuery $query) { return $this->dbAdapter->fetchRow($query->getSelectQuery()); } @@ -234,12 +234,12 @@ class Connection implements Selectable /** * Fetch a column of all rows of the result set as an array * - * @param BaseQuery $query + * @param SimpleQuery $query * @param int $columnIndex Index of the column to fetch * * @return array */ - public function fetchColumn(BaseQuery $query, $columnIndex = 0) + public function fetchColumn(SimpleQuery $query, $columnIndex = 0) { return $this->dbAdapter->fetchCol($query->getSelectQuery()); } @@ -247,11 +247,11 @@ class Connection implements Selectable /** * Fetch the first column of the first row of the result set * - * @param BaseQuery $query + * @param SimpleQuery $query * * @return string */ - public function fetchOne(BaseQuery $query) + public function fetchOne(SimpleQuery $query) { return $this->dbAdapter->fetchOne($query->getSelectQuery()); } @@ -261,11 +261,11 @@ class Connection implements Selectable * * The first column is the key, the second column is the value. * - * @param BaseQuery $query + * @param SimpleQuery $query * * @return array */ - public function fetchPairs(BaseQuery $query) + public function fetchPairs(SimpleQuery $query) { return $this->dbAdapter->fetchPairs($query->getSelectQuery()); } diff --git a/library/Icinga/Data/Db/Query.php b/library/Icinga/Data/Db/Query.php index 05a43c979..561001b3f 100644 --- a/library/Icinga/Data/Db/Query.php +++ b/library/Icinga/Data/Db/Query.php @@ -30,13 +30,13 @@ namespace Icinga\Data\Db; use Zend_Db_Select; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Application\Benchmark; /** * Database query class */ -class Query extends BaseQuery +class Query extends SimpleQuery { /** * @var Zend_Db_Adapter_Abstract diff --git a/library/Icinga/Data/Db/TreeToSqlParser.php b/library/Icinga/Data/Db/TreeToSqlParser.php index 92b42c356..9d41b88e6 100644 --- a/library/Icinga/Data/Db/TreeToSqlParser.php +++ b/library/Icinga/Data/Db/TreeToSqlParser.php @@ -29,7 +29,7 @@ namespace Icinga\Data\Db; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Filter\Query\Tree; use Icinga\Filter\Query\Node; @@ -41,7 +41,7 @@ class TreeToSqlParser /** * The query class to use as the base for converting * - * @var BaseQuery + * @var SimpleQuery */ private $query; @@ -54,9 +54,9 @@ class TreeToSqlParser /** * Create a new converter from this query * - * @param BaseQuery $query The query to use for conversion + * @param SimpleQuery $query The query to use for conversion */ - public function __construct(BaseQuery $query) + public function __construct(SimpleQuery $query) { $this->query = $query; } diff --git a/library/Icinga/Data/PivotTable.php b/library/Icinga/Data/PivotTable.php index 4a30741e5..51aaa5611 100644 --- a/library/Icinga/Data/PivotTable.php +++ b/library/Icinga/Data/PivotTable.php @@ -5,7 +5,7 @@ namespace Icinga\Data; use \Zend_Paginator; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Application\Icinga; use Icinga\Web\Paginator\Adapter\QueryAdapter; @@ -14,21 +14,21 @@ class PivotTable /** * The query to fetch as pivot table * - * @var BaseQuery + * @var SimpleQuery */ protected $baseQuery; /** * The query to fetch the x axis labels * - * @var BaseQuery + * @var SimpleQuery */ protected $xAxisQuery; /** * The query to fetch the y axis labels * - * @var BaseQuery + * @var SimpleQuery */ protected $yAxisQuery; @@ -49,11 +49,11 @@ class PivotTable /** * Create a new pivot table * - * @param BaseQuery $query The query to fetch as pivot table + * @param SimpleQuery $query The query to fetch as pivot table * @param string $xAxisColumn The column that contains the labels for the x axis * @param string $yAxisColumn The column that contains the labels for the y axis */ - public function __construct(BaseQuery $query, $xAxisColumn, $yAxisColumn) + public function __construct(SimpleQuery $query, $xAxisColumn, $yAxisColumn) { $this->baseQuery = $query; $this->xAxisColumn = $xAxisColumn; @@ -86,8 +86,8 @@ class PivotTable protected function adjustSorting() { $currentOrderColumns = $this->baseQuery->getOrderColumns(); - $xAxisOrderColumns = array(array($this->baseQuery->getMappedField($this->xAxisColumn), BaseQuery::SORT_ASC)); - $yAxisOrderColumns = array(array($this->baseQuery->getMappedField($this->yAxisColumn), BaseQuery::SORT_ASC)); + $xAxisOrderColumns = array(array($this->baseQuery->getMappedField($this->xAxisColumn), SimpleQuery::SORT_ASC)); + $yAxisOrderColumns = array(array($this->baseQuery->getMappedField($this->yAxisColumn), SimpleQuery::SORT_ASC)); foreach ($currentOrderColumns as $orderInfo) { if ($orderInfo[0] === $xAxisOrderColumns[0][0]) { diff --git a/library/Icinga/Data/BaseQuery.php b/library/Icinga/Data/SimpleQuery.php similarity index 99% rename from library/Icinga/Data/BaseQuery.php rename to library/Icinga/Data/SimpleQuery.php index ed51d657b..cdcbfe6aa 100644 --- a/library/Icinga/Data/BaseQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -6,7 +6,7 @@ use Zend_Controller_Front; use Zend_Paginator; use Icinga\Web\Paginator\Adapter\QueryAdapter; -abstract class BaseQuery implements QueryInterface, Queryable +abstract class SimpleQuery implements QueryInterface, Queryable { /** * Query data source diff --git a/library/Icinga/Protocol/File/Query.php b/library/Icinga/Protocol/File/Query.php index 066fbcd7e..d8806b2bc 100644 --- a/library/Icinga/Protocol/File/Query.php +++ b/library/Icinga/Protocol/File/Query.php @@ -4,7 +4,7 @@ namespace Icinga\Protocol\File; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; /** * Class Query @@ -13,7 +13,7 @@ use Icinga\Data\BaseQuery; * * @package Icinga\Protocol\File */ -class Query extends BaseQuery +class Query extends SimpleQuery { /** * Sort direction diff --git a/library/Icinga/Protocol/Statusdat/Query.php b/library/Icinga/Protocol/Statusdat/Query.php index 14bf766d5..d80449a13 100644 --- a/library/Icinga/Protocol/Statusdat/Query.php +++ b/library/Icinga/Protocol/Statusdat/Query.php @@ -31,14 +31,14 @@ namespace Icinga\Protocol\Statusdat; use Exception; use Icinga\Exception\ProgrammingError; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Protocol\Statusdat\View\MonitoringObjectList; use Icinga\Protocol\Statusdat\Query\IQueryPart; /** * Base implementation for Statusdat queries. */ -class Query extends BaseQuery +class Query extends SimpleQuery { /** * An array denoting valid targets by mapping the query target to diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index 00dcb7ed2..311ebf50d 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -31,7 +31,7 @@ use \Icinga\Web\Form; use \Icinga\Web\Controller\ActionController; use \Icinga\Web\Widget\Tabextension\OutputFormat; use \Icinga\Module\Monitoring\Backend; -use \Icinga\Data\BaseQuery; +use \Icinga\Data\SimpleQuery; use \Icinga\Web\Widget\Chart\InlinePie; use \Icinga\Module\Monitoring\Form\Command\MultiCommandFlagForm; use \Icinga\Module\Monitoring\DataView\HostStatus as HostStatusView; @@ -183,16 +183,16 @@ class Monitoring_MultiController extends ActionController /** * Apply the query-filter received * - * @param $backendQuery BaseQuery The query to apply the filter to + * @param $backendQuery SimpleQuery The query to apply the filter to * @param $filter array Containing the queries of the current request, converted into an * array-structure. - * @param $hostColumn string The name of the host-column in the BaseQuery, defaults to 'host_name' - * @param $serviceColumn string The name of the service-column in the BaseQuery, defaults to 'service-description' + * @param $hostColumn string The name of the host-column in the SimpleQuery, defaults to 'host_name' + * @param $serviceColumn string The name of the service-column in the SimpleQuery, defaults to 'service-description' * - * @return BaseQuery The given BaseQuery + * @return SimpleQuery The given SimpleQuery */ private function applyQueryFilter( - BaseQuery $backendQuery, + SimpleQuery $backendQuery, array $filter, $hostColumn = 'host_name', $serviceColumn = 'service_description' diff --git a/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php index 5d70b60ac..cdca2e8ae 100644 --- a/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php @@ -2,9 +2,9 @@ namespace \Icinga\Module\Monitoring\Backend\Livestatus\Query; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; -class StatusQuery extends BaseQuery implements Filterable +class StatusQuery extends SimpleQuery implements Filterable { protected $available_columns = array( 'host_name', diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php index f5a12fd97..5e6abb4cb 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php @@ -36,7 +36,7 @@ use Icinga\Filter\Query\Node; use Icinga\Filter\Query\Tree; use Icinga\Protocol\Statusdat; use Icinga\Exception; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Protocol\Statusdat\Query as Query; use Icinga\Protocol\Statusdat\View\AccessorStrategy; use Icinga\Filter\Filterable; diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index 7f64f193a..bf53cead2 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -29,7 +29,7 @@ namespace Icinga\Module\Monitoring\DataView; -use Icinga\Data\BaseQuery; +use Icinga\Data\SimpleQuery; use Icinga\Data\Browsable; use Icinga\Data\PivotTable; use Icinga\Data\Sortable; @@ -45,17 +45,17 @@ abstract class DataView implements Browsable, Filterable, Sortable /** * The query used to populate the view * - * @var BaseQuery + * @var SimpleQuery */ private $query; /** * Create a new view * - * @param BaseQuery $query Which backend to query + * @param SimpleQuery $query Which backend to query * @param array $columns Select columns */ - public function __construct(BaseQuery $query, array $columns = null) + public function __construct(SimpleQuery $query, array $columns = null) { $this->query = $query; $this->query->columns($columns === null ? $this->getColumns() : $columns); diff --git a/test/php/library/Icinga/File/CsvTest.php b/test/php/library/Icinga/File/CsvTest.php index 2dcf68870..afe47c84a 100644 --- a/test/php/library/Icinga/File/CsvTest.php +++ b/test/php/library/Icinga/File/CsvTest.php @@ -13,7 +13,7 @@ class CsvTest extends BaseTestCase public function testWhetherValidCsvIsRendered() { $queryMock = Mockery::mock( - 'Icinga\Data\BaseQuery', + 'Icinga\Data\SimpleQuery', array( 'fetchAll' => array( array('col1' => 'val1', 'col2' => 'val2', 'col3' => 'val3', 'col4' => 'val4'),