Flush all table data using `truncate` (resets auto-increment)
@return int
@throws Exception
@throws \Exception
546273
public static function flushAll()
    {
        try {
            return static::getDb()->createCommand()->truncateTable(static::tableName())->execute();
        } catch (Exception $e) {
            if (YII_ENV_DEV) {
                throw $e;
            }
        }
    }
505000
public function truncate()
    {
        $this->db->setQuery('TRUNCATE TABLE ' . $this->db->quoteName($this->getName()))->execute();

        return $this;
    }
29822
public function reset()
    {
        $ret = $this->unload();
        $this->_table = array();
        $this->conditions = array();
        $this->order = array();
        $this->limit = array();

        return $ret;
    }
1121657
public function flush()
    {
        $this->buffer = array_merge($this->cache, $this->buffer);

        return file_put_contents($this->options->get('store'), json_encode($this->buffer));
    }
857068
public function done()
    {
        if ($this->is_done) {
            throw new RuntimeException('This batch insert is already done');
        }

        $this->flush();
        $this->is_done = true;

        return $this->total;
    }
581845
public function flush()
    {
        if ($this->recordSize === 0) {
            return;
        }

        $str = '';
        foreach ($this->records as $record) {
            $str .= $this->recordFormat($record);
        }

        $this->clear();
        $this->write($str);
    }
479051
public function flush()
	{
		$conn = $this->_dbm->acquire( $this->_dbname );

		try
		{
			$stmt = $conn->create( str_replace( ':cond', '1', $this->_sql['delete'] ) );
			$stmt->bind( 1, $this->_siteid, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->execute()->finish();

			$this->_dbm->release( $conn, $this->_dbname );
		}
		catch( Exception $e )
		{
			$this->_dbm->release( $conn, $this->_dbname );
			throw $e;
		}
	}
223682
public function clear()
    {
        $lastQuery = $this->query;
        $this->query = new Query($this->error, $lastQuery->getInitializer());
        $this->query->forceLimit($lastQuery->getLimit());
        $this->query->forceOffset($lastQuery->getOffset());

        if (!is_array($lastQuery->getResultDataType())) {
            $this->query->setResultDataType($lastQuery->getResultDataType());
        }

        return $this;
    }
128736
public function flush()
    {
        $this->cache->flush();

        return $this->database->table($this->config['db_table'])->truncate();
    }
428540
public function batchUpdate()
    {
        if ($this->_entityName === null) {
            throw new \Exception('Please call « handleEntity(ClassMetadata $class) » before using this handler');
        }
        if (!$this->truncateTable()) {
            throw new \Exception('Could not truncate table ' . $this->getSearchIndexTable());
        }
        $em = $this->_em;
        $indexClass = $this->getSearchIndexClass();

        $batchSize = 100;
        $offset = 0;
        $query = $this->_em->createQueryBuilder()
            ->select('o')
            ->from($this->_entityName, 'o')
            ->setMaxResults($batchSize);

        do {
            $query->setFirstResult($offset);
            $entities = $query->getQuery()->execute();
            foreach ($entities as $entity) {
                $fields = $this->searchIndexes[$this->_class->getName()]['fields'];
                foreach ($fields as $field) {
                    $keywords = $entity->analyseField($field);
                    foreach ($keywords as $keyword) {
                        $index = new $indexClass();
                        $index->setObject($entity);
                        $index->setField($field);
                        $index->setKeyword($keyword);
                        $em->persist($index);
                    }
                }
            }

            $em->flush();
            $offset += $batchSize;
        } while (count($entities) > 0);
    }
1034443
public function delete(): int
    {
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->rowCount();
    }
242966
public function resetTable($table)
    {
        $data = $this->getDumpData();

        $this->executeQuery("TRUNCATE TABLE `$table`");
        if (isset($data[$table]["_sql_"])) {
            $this->executeQuery($data[$table]["_sql_"]);
        }
    }
406932
public function truncate()
    {
        if ($this->fake) {
            return $this->fake->truncate();
        }
        $pattern = 'TRUNCATE TABLE ?t';
        $data = array($this->name);
        $this->db->query($pattern, $data);
    }
601999
public static function clear()
    {
        // load session config
        \Config::load('session', true);

        // prompt the user to confirm they want to clear the table.
        $iamsure = \Cli::prompt('Are you sure you want to clear the sessions table?', array('y','n'));

        // if they are sure, then let's drop it
        if ($iamsure === 'y')
        {
            \DBUtil::truncate_table(\Config::get('session.db.table'));
            return \Cli::color('Session database table successfully truncated.', 'green');
        }

        // if we made it to here, than that means the user said no.
        return \Cli::color('Session database table was not cleared.', 'red');
    }
1228747
public function deleteAll()
    {
        $this->_db->createCommand()->truncateTable($this->tableName)->execute();
        $this->_data = [];

        $this->_cache->delete($this->cacheKey);
    }
522504
public function flush()
    {
        if (!$this->getClient()->flush()) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }
    }
670527
public function delete(): int
    {
        try {
            $query = (clone $this)->setDelete()->apply($this->database->getTablePrefixer());
            $compiled = $this->database->getGrammar()->compileDelete($query);
            return $this->database->delete($compiled->getSQL(), $compiled->getBindings());
        } catch (\Throwable $exception) {
            return $this->handleException($exception);
        }
    }