You are here

public function DatabaseSchema_sqlsrv::tableExists in Drupal driver for SQL Server and SQL Azure 7

Same name and namespace in other branches
  1. 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::tableExists()
  2. 7.2 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::tableExists()

Find if a table already exists.

Parameters

$table: Name of the table.

Return value

True if the table exists, false otherwise.

Overrides DatabaseSchema::tableExists

7 calls to DatabaseSchema_sqlsrv::tableExists()
DatabaseSchema_sqlsrv::addField in sqlsrv/schema.inc
Override DatabaseSchema::addField().
DatabaseSchema_sqlsrv::addIndex in sqlsrv/schema.inc
Override DatabaseSchema::addIndex().
DatabaseSchema_sqlsrv::addPrimaryKey in sqlsrv/schema.inc
Override DatabaseSchema::addPrimaryKey().
DatabaseSchema_sqlsrv::addUniqueKey in sqlsrv/schema.inc
Override DatabaseSchema::addUniqueKey().
DatabaseSchema_sqlsrv::createTable in sqlsrv/schema.inc
Create a new table from a Drupal table definition.

... See full list

File

sqlsrv/schema.inc, line 145
Database schema code for Microsoft SQL Server database servers.

Class

DatabaseSchema_sqlsrv

Code

public function tableExists($table) {
  return $this->connection
    ->query("SELECT 1 FROM INFORMATION_SCHEMA.tables WHERE table_name = '" . $this->connection
    ->prefixTables('{' . $table . '}') . "'")
    ->fetchField() !== FALSE;
}