1 database.inc | public DatabaseConnection::makeComment($comments) |
Flatten an array of query comments into a single comment string.
The comment string will be sanitized to avoid SQL injection attacks.
Parameters
string[] $comments: An array of query comment strings.
Return value
string: A sanitized comment string.
File
- core/
includes/ database/ database.inc, line 662 - Core systems for the database layer.
Class
- DatabaseConnection
- Base Database API class.
Code
public function makeComment($comments) { // phpcs:ignore -- No type hint on $comments, add in 2.x.
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) . ' */ ';
}