You are here

public function FrxDrupal::searchTableColumns in Forena Reports 8

Generate a list of columns for a table.

Parameters

string $table: Name of table to search for.

string $str: Search string for column name.

Return value

array Array of column names found.

Overrides DriverBase::searchTableColumns

File

src/FrxPlugin/Driver/FrxDrupal.php, line 69
Provides data blocks for native drupal connections using the default drupal connections.

Class

FrxDrupal
Class FrxDrupal

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function searchTableColumns($table, $str) {
  $str .= '%';
  $table = trim($table, '{} ');
  $key = $this->database ? $this->database : 'default';
  $info = Database::getConnectionInfo($key);
  $database = $info[$key]['database'];
  $rs = db_query($this
    ->searchTableColumnsSQL(), array(
    ':str' => $str,
    ':database' => $database,
    ':table' => $table,
  ));
  if ($rs) {
    return $rs
      ->fetchCol();
  }
  else {
    return NULL;
  }
}