You are here

public function DriverBase::searchTablesSQL in Forena Reports 8

5 calls to DriverBase::searchTablesSQL()
FrxDrupal::searchTables in src/FrxPlugin/Driver/FrxDrupal.php
Method to return an array of tables that start with the string indicated in $str
FrxMSSQL::searchTables in src/FrxPlugin/Driver/FrxMSSQL.php
Perform search of tables.
FrxOracle::searchTables in src/FrxPlugin/Driver/FrxOracle.php
Method to return an array of tables that start with the string indicated in $str
FrxPDO::searchTables in src/FrxPlugin/Driver/FrxPDO.php
Method to return an array of tables that start with the string indicated in $str
FrxPostgres::searchTables in src/FrxPlugin/Driver/FrxPostgres.php
Method to return an array of tables that start with the string indicated in $str

File

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

Class

DriverBase

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function searchTablesSQL() {
  switch ($this->db_type) {
    case 'mysql':
      $sql = "SHOW TABLES LIKE :str";
      break;
    case 'postgres':
    case 'postgresql':
    case 'pgsql':
      $sql = "SELECT tablename from (\n            SELECT schemaname, tablename FROM pg_catalog.pg_tables\n            UNION SELECT schemaname, viewname from pg_catalog.pg_views) v\n            where schemaname NOT IN ('pg_catalog', 'information_schema') and tablename like :str\n            order by 1";
      break;
    case 'oracle':
    case 'oci':
      $sql = "SELECT object_name FROM all_objects where object_type in ('TABLE','VIEW')\n          AND owner not in ('SYS') AND object_name LIKE :str";
      break;
    case 'mssql':
      $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'\n             and table_name like :str";
      break;
    case 'sqlite':
      $sql = 'SELECT name FROM sqlite_master WHERE name like :str';
      break;
    default:
      $this
        ->app()
        ->error($this
        ->app()
        ->t('Unknown database type: %s', array(
        '%s' => $this->db_type,
      )), 'error');
  }
  return $sql;
}