Query::comment

public function 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

Query The called object.

File

includes/database/query.inc, line 413
Non-specific Database query code. Used by all engines.

Class

Query
Base class for query builders.

Code

public function comment($comment) {
  $this->comments[] = $comment;
  return $this;
}

© 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!query.inc/function/Query::comment/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部