You are here

public function FrxDataSource::searchTableColumnsSQL in Forena Reports 7.4

5 calls to FrxDataSource::searchTableColumnsSQL()
FrxDrupal::searchTableColumns in plugins/FrxDrupal.inc
Generate a list of columns for a table.
FrxMSSQL::searchTableColumns in plugins/FrxMSSQL.inc
Perform search of tables.
FrxOracle::searchTableColumns in plugins/FrxOracle.inc
Search table columns for match
FrxPDO::searchTableColumns in plugins/FrxPDO.inc
FrxPostgres::searchTableColumns in plugins/FrxPostgres.inc

File

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