Skip navigation
Help

DeleteQuery_sqlite

  1. drupal
    1. 7 drupal/includes/database/sqlite/query.inc

SQLite specific implementation of DeleteQuery.

When the WHERE is omitted from a DELETE statement and the table being deleted has no triggers, SQLite uses an optimization to erase the entire table content without having to visit each row of the table individually.

Prior to SQLite 3.6.5, SQLite does not return the actual number of rows deleted by that optimized "truncate" optimization.

Hierarchy

Properties

NameDescription
DeleteQuery::$conditionThe condition object for this query.
DeleteQuery::$tableThe table from which to delete.
Query::$commentsAn array of comments that can be prepended to a query.
Query::$connectionThe connection object on which to run this query.
Query::$connectionKeyThe key of the connection object.
Query::$connectionTargetThe target of the connection object.
Query::$nextPlaceholderThe placeholder counter.
Query::$queryOptionsThe query options to pass on to the connection object.

Functions & methods

NameDescription
DeleteQuery::argumentsImplements QueryConditionInterface::arguments(). Overrides QueryConditionInterface::arguments
DeleteQuery::compileImplements QueryConditionInterface::compile(). Overrides QueryConditionInterface::compile
DeleteQuery::conditionImplements QueryConditionInterface::condition(). Overrides QueryConditionInterface::condition
DeleteQuery::conditionsImplements QueryConditionInterface::conditions(). Overrides QueryConditionInterface::conditions
DeleteQuery::existsImplements QueryConditionInterface::exists(). Overrides QueryConditionInterface::exists
DeleteQuery::isNotNullImplements QueryConditionInterface::isNotNull(). Overrides QueryConditionInterface::isNotNull
DeleteQuery::isNullImplements QueryConditionInterface::isNull(). Overrides QueryConditionInterface::isNull
DeleteQuery::notExistsImplements QueryConditionInterface::notExists(). Overrides QueryConditionInterface::notExists
DeleteQuery::whereImplements QueryConditionInterface::where(). Overrides QueryConditionInterface::where
DeleteQuery::__constructConstructs a DeleteQuery object. Overrides Query::__construct
DeleteQuery::__toStringImplements PHP magic __toString method to convert the query to a string. Overrides Query::__toString
DeleteQuery_sqlite::executeExecutes the DELETE query. Overrides DeleteQuery::execute
Query::commentAdds a comment to the query.
Query::getCommentsReturns a reference to the comments array for the query.
Query::nextPlaceholderGets the next placeholder value for this query object. Overrides QueryPlaceholderInterface::nextPlaceholder
Query::__sleepImplements the magic __sleep function to disconnect from the database.
Query::__wakeupImplements the magic __wakeup function to reconnect to the database.

File

drupal/includes/database/sqlite/query.inc, line 130
Query code for SQLite embedded database engine.

View source
class DeleteQuery_sqlite extends DeleteQuery {
  public function execute() {
    if (!count($this->condition)) {
      $total_rows = $this->connection->query('SELECT COUNT(*) FROM {' . $this->connection->escapeTable($this->table) . '}')->fetchField();
      parent::execute();
      return $total_rows;
    }
    else {
      return parent::execute();
    }
  }
}

Related topics