Truncates the database table if necesary. This is NOT a distributable
initializer, since it can only happen once.
432810
@Initialize(distributed = false)
    public void truncateIfNecesary() {
        if (truncateTable) {
            final UpdateableDatastoreConnection con = datastore.openConnection();
            try {
                final SchemaNavigator schemaNavigator = con.getSchemaNavigator();

                final Table table = schemaNavigator.convertToTable(schemaName, tableName);

                final UpdateableDataContext dc = con.getUpdateableDataContext();
                dc.executeUpdate(new UpdateScript() {
                    @Override
                    public void run(UpdateCallback callback) {
                        final RowDeletionBuilder delete = callback.deleteFrom(table);
                        if (logger.isInfoEnabled()) {
                            logger.info("Executing truncating DELETE operation: {}", delete.toSql());
                        }
                        delete.execute();
                    }
                });
            } finally {
                con.close();
            }
        }
    }
242966
public function resetTable($table)
    {
        $data = $this->getDumpData();

        $this->executeQuery("TRUNCATE TABLE `$table`");
        if (isset($data[$table]["_sql_"])) {
            $this->executeQuery($data[$table]["_sql_"]);
        }
    }
722377
def truncate_data(offset)
      for t in ALL_COLUMNS
        times = @times[t]
        @times[t] = @times[t][offset, times.size]
        @repeat = @times[t].size
      end
      @analysis = nil
      self
    end
251592
protected function truncateDatabase()
    {
        $db = $this->db;
        $schemas = $db->schema->getTableSchemas();

        // First drop all foreign keys,
        foreach ($schemas as $schema) {
            if ($schema->foreignKeys) {
                foreach ($schema->foreignKeys as $name => $foreignKey) {
                    $db->createCommand()->dropForeignKey($name, $schema->name)->execute();
                    $this->stdout("Foreign key $name dropped.\n");
                }
            }
        }

        // Then drop the tables:
        foreach ($schemas as $schema) {
            $db->createCommand()->dropTable($schema->name)->execute();
            $this->stdout("Table {$schema->name} dropped.\n");
        }
    }
346069
public function truncate()
    {
        foreach ($this->tables as $table) {
            $this->db->query("DELETE FROM $table");
        }

        $this->tables = array();
    }
1324934
public function truncate(array $tables = null)
    {
        if (null === $this->db) {
            return;
        }

        if (null === $tables) {
            $tables = $this->tables;
        }

        foreach ($tables as $table) {
            $this->db->query("DELETE FROM $table");
        }

        $this->tables = array_diff($this->tables, $tables);
    }
517596
def truncate_table(self, tablename):
        
        self.cursor.execute('TRUNCATE TABLE %s' %tablename)
        self.db.commit()
485142
public void deleteTable() {
    // [START bigtable_delete_table]
    // Deletes the entire table.
    System.out.println("\nDelete table: " + tableId);
    try {
      adminClient.deleteTable(tableId);
      System.out.printf("Table: %s deleted successfully%n", tableId);
    } catch (NotFoundException e) {
      System.err.println("Failed to delete a non-existent table: " + e.getMessage());
    }
    // [END bigtable_delete_table]
  }
1092956
public function truncate(string $table)
    {
        $compiler = $this->connection->schemaCompiler();

        $result = $compiler->truncate($table);

        $this->connection->command($result['sql'], $result['params']);
    }
967381
public function truncateTable($table)
    {
        $query = "TRUNCATE " . $this->getName($table->getName());
        $this->db->exec($query);
        return $this;
    }
102222
public function dispose() {
        // We shouldn't have any temp table registered at the end of the script.
        // So we error_log that and, at the same time, drop all the pending temptables
        if ($temptables = $this->get_temptables()) {
            error_log('Potential coding error - existing temptables found when disposing database. Must be dropped!');
            foreach ($temptables as $temptable) {
                 $this->mdb->get_manager()->drop_table(new xmldb_table($temptable));
            }
        }
        $this->mdb = null;
    }
558286
public void remove() throws DBException
    {
        super.remove();
        Iterator<BaseTable> iterator = this.getTables();
        while (iterator.hasNext())
        {
            BaseTable table = iterator.next();
            if ((table != null) && (table != this.getNextTable()))
            {
                if ((table.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (table.getRecord().getEditMode() == Constants.EDIT_CURRENT))
                    table.remove();
            }
        }
    }
925846
private void truncate(long handle, boolean isSP)
    {
        // MIN value means no work to do, is a startup condition
        if (handle == Long.MIN_VALUE) {
            return;
        }

        Deque<RepairLog.Item> deq = null;
        if (isSP) {
            deq = m_logSP;
            if (m_truncationHandle < handle) {
                m_truncationHandle = handle;
                notifyTxnCommitInterests(handle);
            }
        }
        else {
            deq = m_logMP;
        }

        RepairLog.Item item = null;
        while ((item = deq.peek()) != null) {
            if (item.canTruncate(handle)) {
                deq.poll();
            } else {
                break;
            }
        }
    }
323485
private static void truncateUsers(String tableName, Statement ddlStatement, Connection connection) throws SQLException {
    try (PreparedStatement preparedStatement = connection.prepareStatement("delete from users where login <> ?")) {
      preparedStatement.setString(1, "admin");
      preparedStatement.execute();
      // commit is useless on some databases
      connection.commit();
    }
    // "admin" is not flagged as root by default
    try (PreparedStatement preparedStatement = connection.prepareStatement("update users set is_root=?")) {
      preparedStatement.setBoolean(1, false);
      preparedStatement.execute();
      // commit is useless on some databases
      connection.commit();
    }
  }
1199562
public static Truncate truncate(@NonNull String table) {
    return truncate(null, CqlIdentifier.fromCql(table));
  }
78500
static function cleanAll()
    {
        $db = eZDB::instance();
        $definition = eZISBNRegistrantRange::definition();
        $table = $definition['name'];
        $sql = "TRUNCATE TABLE " . $table;
        $db->query( $sql );
    }
511609
public function truncateTables()
    {
        $dbName = env('DB_DATABASE');

        // Get all tables list, except migrations table
        $tables = DB::select('SHOW TABLES WHERE `Tables_in_'.$dbName.'` != ?', ['migrations']);

        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        foreach ($tables as $table) {
            DB::table($table->{'Tables_in_' . $dbName})->truncate();
        }
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }