You are here

public function FrxPostgres::searchTables in Forena Reports 8

Method to return an array of tables that start with the string indicated in $str

Parameters

string $str : Partial table Name to search.

Return value

array Array of tables to search. :

Overrides DriverBase::searchTables

File

src/FrxPlugin/Driver/FrxPostgres.php, line 230
Postgres specific driver that takes advantage of native XML support

Class

FrxPostgres
Class FrxPostgres

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function searchTables($str) {
  $str .= '%';
  $db = $this->db;
  $sql = $this
    ->searchTablesSQL();
  $str = pg_escape_string($str);
  $str = "'{$str}'";
  $sql = str_replace(':str', $str, $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;
}