Hierarchy
Properties
| Name | Description |
|---|---|
| Query::$comments | An array of comments that can be prepended to a query. |
| Query::$connection | The connection object on which to run this query. |
| Query::$connectionKey | The key of the connection object. |
| Query::$connectionTarget | The target of the connection object. |
| Query::$nextPlaceholder | The placeholder counter. |
| Query::$queryOptions | The query options to pass on to the connection object. |
| Query::$uniqueIdentifier | A unique identifier for this query object. |
| TruncateQuery::$table | The table to truncate. |
Functions & methods
| Name | Description |
|---|---|
| Query::comment | Adds a comment to the query. |
| Query::getComments | Returns a reference to the comments array for the query. |
| Query::nextPlaceholder | Gets the next placeholder value for this query object. Overrides QueryPlaceholderInterface::nextPlaceholder |
| Query::uniqueIdentifier | Returns a unique identifier for this object. Overrides QueryPlaceholderInterface::uniqueIdentifier |
| Query::__clone | Implements the magic __clone function. |
| Query::__sleep | Implements the magic __sleep function to disconnect from the database. |
| Query::__wakeup | Implements the magic __wakeup function to reconnect to the database. |
| TruncateQuery::compile | Implements QueryConditionInterface::compile(). |
| TruncateQuery::compiled | Implements QueryConditionInterface::compiled(). |
| TruncateQuery::execute | Executes the TRUNCATE query. Overrides Query::execute |
| TruncateQuery::__construct | Constructs a TruncateQuery object. Overrides Query::__construct |
| TruncateQuery_mysql::__toString | Implements PHP magic __toString method to convert the query to a string. Overrides TruncateQuery::__toString |
File
- includes/
database/ mysql/ query.inc, line 89 - Query code for MySQL embedded database engine.
View source
class TruncateQuery_mysql extends TruncateQuery {
public function __toString() {
// TRUNCATE is actually a DDL statement on MySQL, and DDL statements are
// not transactional, and result in an implicit COMMIT. When we are in a
// transaction, fallback to the slower, but transactional, DELETE.
if ($this->connection->inTransaction()) {
// Create a comment string to prepend to the query.
$comments = $this->connection->makeComment($this->comments);
return $comments . 'DELETE FROM {' . $this->connection->escapeTable($this->table) . '}';
}
else {
return parent::__toString();
}
}
}