function Schema::prepareComment

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()
Same name and namespace in other branches
  1. 9 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::prepareComment()
  2. 9 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()
  3. 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::prepareComment()
  4. 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()
  5. 11.x core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::prepareComment()
  6. 11.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()

Overrides Schema::prepareComment

2 calls to Schema::prepareComment()
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::createTableSql in core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 669

Class

Schema
MySQL implementation of <a href="/api/drupal/core%21lib%21Drupal%21Core%21Database%21Schema.php/class/Schema/8.9.x" title="Provides a base implementation for Database Schema." class="local">\Drupal\Core\Database\Schema</a>.

Namespace

Drupal\Core\Database\Driver\mysql

Code

public function prepareComment($comment, $length = NULL) {
    // Truncate comment to maximum comment length.
    if (isset($length)) {
        // Add table prefixes before truncating.
        $comment = Unicode::truncate($this->connection
            ->prefixTables($comment), $length, TRUE, TRUE);
    }
    // Remove semicolons to avoid triggering multi-statement check.
    $comment = strtr($comment, [
        ';' => '.',
    ]);
    return $this->connection
        ->quote($comment);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.