function DatabaseSchema_pgsql::tableExists

Overrides DatabaseSchema::tableExists

6 calls to DatabaseSchema_pgsql::tableExists()
DatabaseSchema_pgsql::addField in includes/database/pgsql/schema.inc
Add a new field to a table.
DatabaseSchema_pgsql::addIndex in includes/database/pgsql/schema.inc
Add an index.
DatabaseSchema_pgsql::addPrimaryKey in includes/database/pgsql/schema.inc
Add a primary key.
DatabaseSchema_pgsql::addUniqueKey in includes/database/pgsql/schema.inc
Add a unique key.
DatabaseSchema_pgsql::dropTable in includes/database/pgsql/schema.inc
Drop a table.

... See full list

File

includes/database/pgsql/schema.inc, line 420

Class

DatabaseSchema_pgsql

Code

public function tableExists($table) {
    // In PostgreSQL "unquoted names are always folded to lower case."
    // @see DatabaseSchema_pgsql::buildTableNameCondition().
    $prefixInfo = $this->getPrefixInfo(strtolower($table), TRUE);
    return (bool) $this->connection
        ->query("SELECT 1 FROM pg_tables WHERE schemaname = :schema AND tablename = :table", array(
        ':schema' => $prefixInfo['schema'],
        ':table' => $prefixInfo['table'],
    ))
        ->fetchField();
}

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