1 schema.inc public DatabaseSchema_mysql::prepareComment($comment, $length = NULL)

Prepare a table or column comment for database query.

Parameters

string $comment: The comment string to prepare.

int|null $length: Optional upper limit on the returned string length.

Return value

string: The prepared comment.

Overrides DatabaseSchema::prepareComment

File

core/includes/database/mysql/schema.inc, line 566
Database schema code for MySQL database servers.

Class

DatabaseSchema_mysql
Class to create and manipulate MySQL tables.

Code

public function prepareComment($comment, $length = NULL) {
  // Work around a bug in some versions of PDO.
  // See http://bugs.php.net/bug.php?id=41125
  $comment = str_replace("'", '’', $comment);

  // Prefix tables, but remove any back-ticks.
  $comment = str_replace('`', '', $this->connection->prefixTables($comment));

  // Truncate comment to maximum comment length.
  if (isset($length)) {
    $comment = truncate_utf8($comment, $length, TRUE, TRUE);
  }

  return $this->connection->quote($comment);
}