You are here

public function DriverBase::searchTableColumnsSQL in Forena Reports 8

5 calls to DriverBase::searchTableColumnsSQL()
FrxDrupal::searchTableColumns in src/FrxPlugin/Driver/FrxDrupal.php
Generate a list of columns for a table.
FrxMSSQL::searchTableColumns in src/FrxPlugin/Driver/FrxMSSQL.php
Perform search of tables.
FrxOracle::searchTableColumns in src/FrxPlugin/Driver/FrxOracle.php
Search table columns for match
FrxPDO::searchTableColumns in src/FrxPlugin/Driver/FrxPDO.php
FrxPostgres::searchTableColumns in src/FrxPlugin/Driver/FrxPostgres.php

File

src/FrxPlugin/Driver/DriverBase.php, line 566
Class that defines default methods for access control in an DriverBase

Class

DriverBase

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function searchTableColumnsSQL() {
  switch ($this->db_type) {
    case 'mysql':
      $sql = "select column_name from information_schema.COLUMNS where\n             table_schema = :database\n             AND table_name = :table AND column_name like :str";
      break;
    case 'postgres':
    case 'postgresql':
    case 'pgsql':
      $sql = "SELECT column_name from\n            information_schema.columns\n            WHERE\n              table_catalog = :database\n              AND table_name = :table\n              AND column_name like :str\n            order by 1";
      break;
    case 'oracle':
    case 'oci':
      $sql = "SELECT column_name FROM all_tab_columns where\n          table_name = :table_name\n          AND column_name LIKE :str";
      break;
    case 'mssql':
      $sql = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS\n            WHERE TABLE_NAME = :table and column_name like :str";
      break;
    case 'sqlite':
      $sql = 'PRAGMA table_info(:table)';
      break;
    default:
      $this
        ->app()
        ->error($this
        ->app()
        ->t('Unknown database type: %s', array(
        '%s' => $this->db_type,
      )), 'error');
  }
  return $sql;
}