Connection::makeComment

public Connection::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/lib/Drupal/Core/Database/Connection.php, line 491

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

1
2
3
4
5
6
7
8
9
10
11
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) . ' */ ';
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.