1 query.inc | public DeleteQuery::__toString() |
Implements PHP magic __toString method to convert the query to a string.
The toString operation is how we compile a query object to a prepared statement.
Return value
string: A prepared statement query string for this object.
Overrides Query::__toString
File
- core/
includes/ database/ query.inc, line 895 - Non-specific Database query code. Used by all engines.
Class
- DeleteQuery
- General class for an abstracted DELETE operation.
Code
public function __toString() {
// Create a sanitized comment string to prepend to the query.
$comments = $this->connection->makeComment($this->comments);
$query = $comments . 'DELETE FROM {' . $this->connection->escapeTable($this->table) . '} ';
if (count($this->condition)) {
$this->condition->compile($this->connection, $this);
$query .= "\nWHERE " . $this->condition;
}
return $query;
}