public function DriverBase::buildFilterSQL in Forena Reports 8
Build the SQL clause based on builder data.
Parameters
$data:
Return value
string Where clause for SQL.
File
- src/
FrxPlugin/ Driver/ DriverBase.php, line 440 - Class that defines default methods for access control in an DriverBase
Class
Namespace
Drupal\forena\FrxPlugin\DriverCode
public function buildFilterSQL($data) {
$clause = '';
$op = $data['op'];
$i = 0;
if ($data['filter']) {
foreach ($data['filter'] as $cond) {
$i++;
$conj = $i == 1 ? '' : $op . ' ';
if (isset($cond['filter'])) {
$clause .= $conj . ' (' . $this
->buildFilterSQL($cond) . " )\n";
}
else {
switch ($cond['op']) {
case 'IS NULL':
case 'IS NOT NULL':
$expr = $cond['field'] . ' ' . $cond['op'];
break;
default:
$expr = $cond['field'] . ' ' . $cond['op'] . ' ' . $this
->format($cond['value'], $cond['field'], array());
}
$clause .= ' ' . $conj . $expr;
}
}
}
return $clause;
}