Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseConnection::makeComment

Flatten an array of query comments into a single comment string.

The comment string will be sanitized to avoid SQL injection attacks.

Parameters

$comments: An array of query comment strings.

Return value

A sanitized comment string.

File

includes/database/database.inc, line 647

Class

DatabaseConnection
Base Database API class.

Code

public function makeComment($comments) {
 if (empty($comments)) {
 return '';
 }
 // Flatten the array of comments.
 $comment = implode ('; ', $comments);
 // Sanitize the comment string so as to avoid SQL injection attacks.
 return '/* ' . $this->filterComment ($comment) . ' */ ';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.