From c5926f4961506ad886e6110bc506bf72e4588bc8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 3 May 2009 08:56:19 +0000 Subject: - Patch #396578 by Damien Tournoud: added db_truncate_table() to the database layer. --- includes/database/sqlite/query.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'includes/database/sqlite') diff --git a/includes/database/sqlite/query.inc b/includes/database/sqlite/query.inc index ab6e2da50..98fa80754 100644 --- a/includes/database/sqlite/query.inc +++ b/includes/database/sqlite/query.inc @@ -135,6 +135,18 @@ class DeleteQuery_sqlite extends DeleteQuery { } } +/** + * 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). + */ +class TruncateQuery_sqlite extends TruncateQuery { + public function __toString() { + return 'DELETE FROM {' . $this->connection->escapeTable($this->table) . '} '; + } +} + /** * @} End of "ingroup database". */ -- cgit v1.2.3