You are here

public function DatabaseSchema_sqlite::tableExists in Drupal 7

Check if a table exists.

Parameters

$table: The name of the table in drupal (no prefixing).

Return value

TRUE if the given table exists, otherwise FALSE.

Overrides DatabaseSchema::tableExists

7 calls to DatabaseSchema_sqlite::tableExists()
DatabaseSchema_sqlite::addField in includes/database/sqlite/schema.inc
Add a new field to a table.
DatabaseSchema_sqlite::addIndex in includes/database/sqlite/schema.inc
Add an index.
DatabaseSchema_sqlite::addPrimaryKey in includes/database/sqlite/schema.inc
Add a primary key.
DatabaseSchema_sqlite::addUniqueKey in includes/database/sqlite/schema.inc
Add a unique key.
DatabaseSchema_sqlite::alterTable in includes/database/sqlite/schema.inc
Create a table with a new schema containing the old content.

... See full list

File

includes/database/sqlite/schema.inc, line 21
Database schema code for SQLite databases.

Class

DatabaseSchema_sqlite

Code

public function tableExists($table) {
  $info = $this
    ->getPrefixInfo($table);

  // Don't use {} around sqlite_master table.
  return (bool) $this->connection
    ->query('SELECT 1 FROM ' . $info['schema'] . '.sqlite_master WHERE type = :type AND name = :name', array(
    ':type' => 'table',
    ':name' => $info['table'],
  ))
    ->fetchField();
}