protected function Schema::primaryKeyName 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::primaryKeyName()
- 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::primaryKeyName()
Return the name of the primary key of a table if it exists.
4 calls to Schema::primaryKeyName()
- Schema::addPrimaryKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::addPrimaryKey().
- Schema::cleanUpPrimaryKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Drop the primary key constraint.
- Schema::cleanUpTechnicalPrimaryColumn in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Tries to clean up the technical primary column. It will be deleted if (a) It is not being used as the current primary key and... (b) There is no unique constraint because they depend on this column (see addUniqueKey())
- Schema::dropPrimaryKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::dropPrimaryKey().
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 1463 - Definition of Drupal\Driver\Database\sqlsrv\Schema
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
protected function primaryKeyName($table) {
$table = $this->connection
->prefixTables('{' . $table . '}');
return $this->connection
->query('SELECT name FROM sys.key_constraints WHERE parent_object_id = OBJECT_ID(:table) AND type = :type', array(
':table' => $table,
':type' => 'PK',
))
->fetchField();
}