SQLite specific implementation of TruncateQuery.
SQLite doesn't support TRUNCATE, but a DELETE query with no condition has exactly the effect (it is implemented by DROPing the table).
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_sqlite::__toString | Implements PHP magic __toString method to convert the query to a string. Overrides TruncateQuery::__toString |
File
- includes/
database/ sqlite/ query.inc, line 149 - Query code for SQLite embedded database engine.
View source
class TruncateQuery_sqlite extends TruncateQuery {
public function __toString() {
// Create a sanitized comment string to prepend to the query.
$comments = $this->connection->makeComment($this->comments);
return $comments . 'DELETE FROM {' . $this->connection->escapeTable($this->table) . '} ';
}
}