You are here

public function FrxOracle::searchTableColumns in Forena Reports 8

Search table columns for match

Overrides DriverBase::searchTableColumns

See also

FrxDataSource::searchTableColumns()

File

src/FrxPlugin/Driver/FrxOracle.php, line 445
Oracle specific driver that takes advantage of oracles native XML support

Class

FrxOracle
Class FrxOracle

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function searchTableColumns($table, $str) {
  $str = strtoupper($str) . '%';
  $db = $this->db;
  $sql = $this
    ->searchTableColumnsSQL();
  $table = strtoupper($table);
  $stmt = oci_parse($db, $sql);
  oci_bind_by_name($stmt, ':table_name', $table);
  oci_bind_by_name($stmt, ":str", $str);
  oci_execute($stmt);
  $data = array();
  $columns = array();
  oci_fetch_all($stmt, $data, 0, 100, OCI_NUM);
  if ($data) {
    foreach ($data[0] as $column) {
      $columns[] = strtolower($column);
    }
  }
  return $columns;
}