You are here

public function FrxDataSource::searchTablesSQL in Forena Reports 7.4

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

File

./FrxDataSource.inc, line 478
Class that defines default methods for access control in an FrxDataSource

Class

FrxDataSource
@file Class that defines default methods for access control in an FrxDataSource

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:
      drupal_set_message(t('Unknown database type: %s', array(
        '%s' => $this->db_type,
      )), 'error');
  }
  return $sql;
}