public function Schema::prepareComment in Drupal 10
Same name in this branch
- 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::prepareComment()
- 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\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
The prepared comment.
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 647
Class
- Schema
- MySQL implementation of \Drupal\Core\Database\Schema.
Namespace
Drupal\mysql\Driver\Database\mysqlCode
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);
}