Query::comment

public Query::comment($comment)

Adds a comment to the query.

By adding a comment to a query, you can more easily find it in your query log or the list of active queries on an SQL server. This allows for easier debugging and allows you to more easily find where a query with a performance problem is being generated.

The comment string will be sanitized to remove * / and other characters that may terminate the string early so as to avoid SQL injection attacks.

Parameters

$comment: The comment string to be inserted into the query.

Return value

$this

File

core/lib/Drupal/Core/Database/Query/Query.php, line 154

Class

Query
Base class for query builders.

Namespace

Drupal\Core\Database\Query

Code

public function comment($comment) {
  $this->comments[] = $comment;
  return $this;
}
doc_Drupal
2016-10-29 09:35:23
Comments
Leave a Comment

Please login to continue.