You are here

public function FrxPostgres::searchTableColumns in Forena Reports 7.4

Overrides FrxDataSource::searchTableColumns

File

plugins/FrxPostgres.inc, line 237
Postgres specific driver that takes advantage of native XML support

Class

FrxPostgres
@file Postgres specific driver that takes advantage of native XML support

Code

public function searchTableColumns($table, $str) {
  $str .= '%';
  $db = $this->db;
  $sql = $this
    ->searchTableColumnsSQL();
  $str = pg_escape_string($str);
  $str = "'{$str}'";
  $sql = str_replace(':str', $str, $sql);
  $table = pg_escape_string($table);
  $table = "'{$table}'";
  $sql = str_replace(':table', $table, $sql);
  $info = $this
    ->parseConnectionStr();
  $database = isset($info['dbname']) ? $info['dbname'] : @$info['database'];
  $database = pg_escape_string($database);
  $database = "'{$database}'";
  $sql = str_replace(':database', $database, $sql);
  $rs = @pg_query($sql);
  $rownum = 0;
  $tables = array();
  if ($rs) {
    $tables = pg_fetch_all_columns($rs, 0);
  }
  if ($rs) {
    pg_free_result($rs);
  }
  return $tables;
}