function Schema::prepareComment

Same name in this branch
  1. 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()
Same name 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. 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::prepareComment()
  4. 8.9.x 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/modules/mysql/src/Driver/Database/mysql/Schema.php
Create an SQL string for a field to be used in table creation or alteration.
Schema::createTableSql in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

core/modules/mysql/src/Driver/Database/mysql/Schema.php, line 656

Class

Schema
MySQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\mysql\Driver\Database\mysql

Code

public function prepareComment($comment, $length = NULL) {
    // Truncate comment to maximum comment length.
    if (isset($length)) {
        // Add table prefix 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.