Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseSchema_sqlite::tableExists

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

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 ();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.