public function Schema::fieldExists in Drupal driver for SQL Server and SQL Azure 8
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::fieldExists()
 - 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::fieldExists()
 
Check if a column exists in the given table.
Parameters
$table: The name of the table in drupal (no prefixing).
$column: The name of the column.
Return value
TRUE if the given column exists, otherwise FALSE.
Overrides Schema::fieldExists
7 calls to Schema::fieldExists()
- Schema::addField in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php  - Override DatabaseSchema::addField().
 - Schema::changeField in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php  - Override DatabaseSchema::changeField().
 - Schema::cleanUpPrimaryKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php  - Drop the primary key constraint.
 - Schema::createTechnicalPrimaryColumn in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php  - Add a primary column to the table.
 - Schema::dropField in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php  - Override DatabaseSchema::dropField().
 
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 945  - Definition of Drupal\Driver\Database\sqlsrv\Schema
 
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
public function fieldExists($table, $field) {
  return $this->connection
    ->query("SELECT 1 FROM INFORMATION_SCHEMA.columns WHERE table_name = '" . $this->connection
    ->prefixTables('{' . $table . '}') . "' AND column_name = '" . $field . "'")
    ->fetchField() !== FALSE;
}