Truncate.php 637 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Drupal\Core\Database\Driver\sqlite;
  3. use Drupal\Core\Database\Query\Truncate as QueryTruncate;
  4. /**
  5. * SQLite implementation of \Drupal\Core\Database\Query\Truncate.
  6. *
  7. * SQLite doesn't support TRUNCATE, but a DELETE query with no condition has
  8. * exactly the effect (it is implemented by DROPing the table).
  9. */
  10. class Truncate extends QueryTruncate {
  11. public function __toString() {
  12. // Create a sanitized comment string to prepend to the query.
  13. $comments = $this->connection->makeComment($this->comments);
  14. return $comments . 'DELETE FROM {' . $this->connection->escapeTable($this->table) . '} ';
  15. }
  16. }