Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Schema.php

function Schema::escapeDefaultValue

Escapes a value to be used as the 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.

3 calls to Schema::escapeDefaultValue()
Schema::changeField in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Change a field definition.
Schema::createFieldSql in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Creates a safe SQL string for a field for table creation or alteration.
Schema::createFieldSql in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Create an SQL string for a field to be used in table creation or alteration.

File

core/lib/Drupal/Core/Database/Schema.php, line 700

Class

Schema
Provides a base implementation for Database Schema.

Namespace

Drupal\Core\Database

Code

protected function escapeDefaultValue($value) {
    if (is_null($value)) {
        return 'NULL';
    }
    return is_string($value) ? $this->connection
        ->quote($value) : $value;
}
RSS feed
Powered by Drupal