Truncates all tables
@throws DatabaseException
426360
public function removeAll()
    {
        $pdo = $this->entityManager->getConnection()->getWrappedConnection();
        $pdo->beginTransaction();

        try {

            $pdo->exec('SET FOREIGN_KEY_CHECKS=0');
            $pdo->exec('TRUNCATE role_permission');
            $pdo->exec('TRUNCATE role_hierarchy');
            $pdo->exec('TRUNCATE role');
            $pdo->exec('TRUNCATE permission');
            $pdo->exec('TRUNCATE user_role');
            $pdo->exec('SET FOREIGN_KEY_CHECKS=1');

            $pdo->commit();

        } catch (\Exception $e) {
            $pdo->rollBack();
            throw new DatabaseException($e->getMessage());
        }
    }
546273
public static function flushAll()
    {
        try {
            return static::getDb()->createCommand()->truncateTable(static::tableName())->execute();
        } catch (Exception $e) {
            if (YII_ENV_DEV) {
                throw $e;
            }
        }
    }
511876
public function truncateTable()
    {
        $connection = $this->_em->getConnection();
        $dbPlatform = $connection->getDatabasePlatform();
        $connection->beginTransaction();
        try {
            $q = $dbPlatform->getTruncateTableSql($this->getSearchIndexTable());
            $connection->executeUpdate($q);
            $connection->commit();

            return true;
        } catch (\Exception $e) {
            $connection->rollback();

            return false;
        }
    }
195784
public function dropAllTables()
    {
        $this->disableForeignKeyConstraints();

        $this->connection->statement($this->grammar->compileDropAllTables());

        $this->enableForeignKeyConstraints();
    }
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();
            }
        }
    }
807968
protected function cleanupTempTables()
    {
        $dbHandle = $this->getDatabase()->getDatabaseConnection();

        $query = 'TRUNCATE ' . Database::TABLE_TMP_DEPENDS_NEEDED;
        $dbHandle->query($query);
    }
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();
    }
  }
567164
public function toString()
    {
        if (!$this->_parts['table']) {
            throw new SqlException("Invalid `TRUNCATE` statement, missing `TABLE` clause.");
        }

        return 'TRUNCATE' . $this->_buildClause('TABLE', $this->dialect()->names($this->_parts['table']));
    }
19069
public function deleteAllGeneratorTables()
    {
        $tables = [];

        /**
         * @var ClassMetadata $class
         */
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            $tables = array_merge(
                $tables,
                $this->getGeneratorTablesFor($class)
            );
        }

        foreach ($tables as $tableName => $definition) {
            $this->doDeleteTable($tableName, $definition);
        }
    }
1335791
public int deleteAll() throws SQLException {

		DeleteBuilder<Extensions, Void> db = deleteBuilder();
		int deleted = db.delete();

		return deleted;
	}
1327716
public void truncate() {
        Log.info("Truncating index");
        try {
            indexWriter.deleteAll();
        } catch (IOException e) {
            Log.error(e, "Error while truncating index");
            throw new RuntimeException(e);
        }
    }
62940
@Override
    public final void truncate(ClusterName targetCluster, TableName tableName) throws UnsupportedException,
            ExecutionException {

        try {

            connectionHandler.startJob(targetCluster.getName());
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "Tuncating table [" + tableName.getName() + "] in cluster [" + targetCluster.getName() + "]");
            }
            truncate(tableName, connectionHandler.getConnection(targetCluster.getName()));
            if (logger.isDebugEnabled()) {
                logger.debug("The table [" + tableName.getName() + "] has been successfully truncated in cluster ["
                        + targetCluster.getName() + "]");
            }
        } finally {
            connectionHandler.endJob(targetCluster.getName());
        }
    }
799684
public function removeAll()
    {
        $classMetaData = $this->entityManager->getClassMetadata($this->getEntityClassName());
        $connection = $this->entityManager->getConnection();
        $databasePlatform = $connection->getDatabasePlatform();
        $truncateTableQuery = $databasePlatform->getTruncateTableSql($classMetaData->getTableName());
        $connection->executeUpdate($truncateTableQuery);
    }
1358982
public void close() throws SQLException
	{
		more = false;
		if(!exclusive)
			return;
		if(rs != null)
		{
			rs.close();
			rs = null;
		}
		if(stmt != null)
		{
			stmt.close();
			stmt = null;
		}
	}
300113
public function dropAllTables()
    {
        if ($this->connection->getDatabaseName() !== ':memory:') {
            return $this->refreshDatabaseFile();
        }

        $this->connection->select($this->grammar->compileEnableWriteableSchema());

        $this->connection->select($this->grammar->compileDropAllTables());

        $this->connection->select($this->grammar->compileDisableWriteableSchema());

        $this->connection->select($this->grammar->compileRebuild());
    }
123775
protected function cleanDatabase(array $tables)
    {
        DB::statement($this->getForeignKeyCheck(false));
        foreach ($tables as $table) {
            if (Schema::hasTable($table)) {
                DB::table($table)->truncate();
            }
        }
        DB::statement($this->getForeignKeyCheck(true));
    }
1156330
@Override
  public void close() {
    LOG.info("Closing " + this.getClass().getSimpleName());
    try (Connection conn = createConnection()) {
      JdbcWriterCommands commands = createJdbcWriterCommands(conn);
      if (!this.createdStagingTables.isEmpty()) {
        for (String stagingTable : this.createdStagingTables) {
          LOG.info("Dropping staging table " + this.createdStagingTables);
          commands.drop(database, stagingTable);
        }
      }

      if (this.userCreatedStagingTable != null) {
        LOG.info("Truncating staging table " + this.userCreatedStagingTable);
        commands.truncate(database, this.userCreatedStagingTable);
      }
    } catch (SQLException e) {
      throw new RuntimeException("Failed to close", e);
    }
  }