public function Schema::fieldSetNoDefault in Drupal driver for SQL Server and SQL Azure 8.2
Same name and namespace in other branches
- 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::fieldSetNoDefault()
- 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::fieldSetNoDefault()
Override DatabaseSchema::fieldSetNoDefault().
@status complete
Overrides Schema::fieldSetNoDefault
1 call to Schema::fieldSetNoDefault()
- Schema::fieldSetDefault in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::fieldSetDefault().
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 1043 - Definition of Drupal\Driver\Database\sqlsrv\Schema
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
public function fieldSetNoDefault($table, $field) {
if (!$this
->fieldExists($table, $field)) {
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot remove default value of field %table.%field: field doesn't exist.", array(
'%table' => $table,
'%field' => $field,
)));
}
$real_table = $this->connection
->prefixTable($table);
$constraint_name = "{$real_table}_{$field}_df";
// Avoid PDO exception!!
if (!$this->connection
->Scheme()
->ConstraintExists($constraint_name, new ConstraintTypes(ConstraintTypes::CDEFAULT))) {
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot remove default value of field %table.%field: default value constraint doesn't exist.", array(
'%table' => $table,
'%field' => $field,
)));
}
$this->connection
->query_direct("ALTER TABLE [{$real_table}] DROP CONSTRAINT [{$constraint_name}]");
}