function Schema::escapeDefaultValue
Same name in other branches
- 9 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::escapeDefaultValue()
- 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::escapeDefaultValue()
- 11.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::escapeDefaultValue()
Return an escaped version of its parameter to be used as a default value on a column.
Parameters
mixed $value: The value to be escaped (int, float, null or string).
Return value
string|int|float The escaped value.
5 calls to Schema::escapeDefaultValue()
- Schema::changeField in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Schema.php - Change a field definition.
- Schema::createFieldSql in core/
lib/ Drupal/ Core/ Database/ Driver/ mysql/ Schema.php - Create an SQL string for a field to be used in table creation or alteration.
- Schema::createFieldSql in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Schema.php - Create an SQL string for a field to be used in table creation or alteration.
- Schema::fieldSetDefault in core/
lib/ Drupal/ Core/ Database/ Driver/ mysql/ Schema.php - Set the default value for a field.
- Schema::fieldSetDefault in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Schema.php - Set the default value for a field.
File
-
core/
lib/ Drupal/ Core/ Database/ Schema.php, line 712
Class
- Schema
- Provides a base implementation for Database Schema.
Namespace
Drupal\Core\DatabaseCode
protected function escapeDefaultValue($value) {
if (is_null($value)) {
return 'NULL';
}
return is_string($value) ? $this->connection
->quote($value) : $value;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.