W3cubDocs

/Drupal 8

public function Schema::prepareComment

public Schema::prepareComment($comment, $length = NULL)

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

The prepared comment.

Overrides Schema::prepareComment

File

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

Class

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

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, array(';' => '.'));
  return $this->connection->quote($comment);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!mysql!Schema.php/function/Schema::prepareComment/8.1.x