You are here

public function FrxSQLQueryBuilder::defineColumnFilters in Forena Reports 6

Same name and namespace in other branches
  1. 6.2 FrxSQLQueryBuilder.inc \FrxSQLQueryBuilder::defineColumnFilters()

Set up common column filters This will set up all of the common filters on data ...

Parameters

unknown_type $columns:

unknown_type $comparisons:

1 call to FrxSQLQueryBuilder::defineColumnFilters()
FrxSQLQueryBuilder::defineNumericFilters in ./FrxSQLQueryBuilder.inc
* Helper functon to build common numeric filters. * Enter description here ... *

File

./FrxSQLQueryBuilder.inc, line 50

Class

FrxSQLQueryBuilder
FrxSQLQuery SQL Builder This class defines a common query builder that is used to make SQL safe queries based on named column filteres. @author metzlerd

Code

public function defineColumnFilters($columns, $comparisons = array()) {
  $columns = (array) $columns;
  if ($columns) {
    foreach ($columns as $column) {
      if (!$comparisons) {
        $comparisons = array_keys($this->comparison_operators);
      }
      if ($comparisons) {
        foreach ($comparisons as $comparison) {
          if (array_key_exists($comparison, $this->comparison_operators)) {
            $clause = $column . ' ' . $comparison . ' :' . $column;
            $this
              ->defineFilter($column, $comparison, $clause, $this->comparison_operators[$comparison]);
          }
        }
      }
    }
  }
  return $this;
}