public function DatabaseSchema_mysql::prepareComment

public DatabaseSchema_mysql::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 DatabaseSchema::prepareComment

File

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

Class

DatabaseSchema_mysql

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);

  // Truncate comment to maximum comment length.
  if (isset($length)) {
    // Add table prefixes before truncating.
    $comment = truncate_utf8($this->connection->prefixTables($comment), $length, TRUE, TRUE);
  }

  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/includes!database!mysql!schema.inc/function/DatabaseSchema_mysql::prepareComment/7.x