Skip to content

Commit

Permalink
Refactoring and Query and IDO code,
Browse files Browse the repository at this point in the history
the Monitoring/View code was completly dropped in favor of
the DataView implementations, as new Backends otherwise
would require to implement two seperate query logics

refs #3801
  • Loading branch information
Jannis Moßhammer committed Oct 17, 2013
1 parent df81c85 commit 44be5e8
Show file tree
Hide file tree
Showing 77 changed files with 1,839 additions and 2,917 deletions.
400 changes: 0 additions & 400 deletions library/Icinga/Data/AbstractQuery.php

This file was deleted.

486 changes: 486 additions & 0 deletions library/Icinga/Data/BaseQuery.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion library/Icinga/Data/DataArray/Datasource.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function createResult(Query $query)
}
$result = array();
$filters = $query->listFilters();
$columns = $query->listColumns();
$columns = $query->getColumns();
foreach ($this->data as & $row) {

// Skip rows that do not match applied filters
Expand Down
26 changes: 20 additions & 6 deletions library/Icinga/Data/DataArray/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Icinga\Data\DataArray;

use Icinga\Data\AbstractQuery;
use Icinga\Data\BaseQuery;

class Query extends AbstractQuery
class Query extends BaseQuery
{
/**
* Remember the last count
Expand Down Expand Up @@ -63,16 +63,18 @@ public function setResult($result)
*/
public function compare(& $a, & $b, $col_num = 0)
{
if (! array_key_exists($col_num, $this->order_columns)) {
$orderColumns = $this->getOrderColumns();
if (! array_key_exists($col_num, $orderColumns)) {
return 0;
}
$col = $this->order_columns[$col_num][0];
$dir = $this->order_columns[$col_num][1];

$col = $orderColumns[$col_num][0];
$dir = $orderColumns[$col_num][1];

//$res = strnatcmp(strtolower($a->$col), strtolower($b->$col));
$res = strcmp(strtolower($a->$col), strtolower($b->$col));
if ($res === 0) {
if (array_key_exists(++$col_num, $this->order_columns)) {
if (array_key_exists(++$col_num, $orderColumns)) {
return $this->compare($a, $b, $col_num);
} else {
return 0;
Expand All @@ -84,4 +86,16 @@ public function compare(& $a, & $b, $col_num = 0)
return $res * -1;
}
}

public function parseFilterExpression($expression, $parameters = null)
{
return null;
}

public function applyFilter()
{
return null;
}


}
3 changes: 2 additions & 1 deletion library/Icinga/Data/DatasourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ interface DatasourceInterface
/**
* Instantiate a Query object
*
* @return AbstractQuery
* @return BaseQuery
*/
public function select();

}
Loading

0 comments on commit 44be5e8

Please sign in to comment.