You are here

public function DataManager::buildSQL in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/DataManager.php \Drupal\forena\DataManager::buildSQL()

Build an SQL statement from the data provider

Parameters

string $provider: Data provider name

array $builder: Build information.

Return value

string SQL query.

File

src/DataManager.php, line 311
DataManager.inc Enter description here ... @author davidmetzler

Class

DataManager

Namespace

Drupal\forena

Code

public function buildSQL($provider, $builder) {
  $repos = @$this->repositories[$provider];
  if (isset($repos['enabled']) && !$repos['enabled']) {
    return '';
  }
  $o = $this
    ->repository($provider);
  $sql = "SELECT * FROM (\n";
  $sql .= '--INCLUDE=' . $builder['block_name'] . "\n";
  $sql .= ") t\n";
  if (!empty($builder['where'])) {
    $sql .= "WHERE " . $o
      ->buildFilterSQL($builder['where']);
  }
  return $sql;
}