function Schema::prepareComment

Same name in this branch
  1. 9 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::prepareComment()
Same name and namespace in other branches
  1. 11.x core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::prepareComment()
  2. 11.x 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. 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::prepareComment()
  6. 8.9.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()

Prepare a table or column comment for database query.

Parameters

$comment: The comment string to prepare.

$length: Optional upper limit on the returned string length.

Return value

string The prepared comment.

File

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

Class

Schema
Provides a base implementation for Database Schema.

Namespace

Drupal\Core\Database

Code

public function prepareComment($comment, $length = NULL) {
  // 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.