Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

Truncate.php

Same filename in this branch
  1. 11.1.x core/lib/Drupal/Core/Database/Query/Truncate.php
  2. 11.1.x core/modules/pgsql/src/Driver/Database/pgsql/Truncate.php
  3. 11.1.x core/modules/mysql/src/Driver/Database/mysql/Truncate.php

Namespace

Drupal\sqlite\Driver\Database\sqlite

File

core/modules/sqlite/src/Driver/Database/sqlite/Truncate.php

View source
<?php

namespace Drupal\sqlite\Driver\Database\sqlite;

use Drupal\Core\Database\Query\Truncate as QueryTruncate;

/**
 * SQLite implementation of \Drupal\Core\Database\Query\Truncate.
 *
 * SQLite doesn't support TRUNCATE, but a DELETE query with no condition has
 * exactly the effect (it is implemented by DROPing the table).
 */
class Truncate extends QueryTruncate {
    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) . '} ';
    }

}

Classes

Title Deprecated Summary
Truncate SQLite implementation of \Drupal\Core\Database\Query\Truncate.
RSS feed
Powered by Drupal