Method to truncate a table.

@return  static

@since   2.0
@throws  \RuntimeException
505000
public function truncate()
    {
        $this->db->setQuery('TRUNCATE TABLE ' . $this->db->quoteName($this->getName()))->execute();

        return $this;
    }
418151
public function reset()
	{
		$this->_table      = null;
		$this->_join       = array();
		$this->_set        = array();
		$this->_where      = array();
		$this->_order_by   = array();
		$this->_limit      = null;
		$this->_last_join  = null;
		$this->_parameters = array();

		return $this;
	}
242966
public function resetTable($table)
    {
        $data = $this->getDumpData();

        $this->executeQuery("TRUNCATE TABLE `$table`");
        if (isset($data[$table]["_sql_"])) {
            $this->executeQuery($data[$table]["_sql_"]);
        }
    }
445286
public function truncate($offset, $size)
	{
		if ( ! $this->locked) {
			//\Log::info('Should lock before changes');
		}

		$size = (int)$size;
		$offset = (int)$offset;

//		foreach (array('left', 'right') as $field) {
		foreach (array('lft', 'rgt') as $field) {
			
			$sql = "UPDATE {$this->tableName}
					SET {$field} = {$field} - {$size}
					WHERE {$field} >= {$offset}";

			// additional condition
			$sql .= $this->getAdditionalConditionSql('AND');

			$this->entityManager->getConnection()->exec($sql);
			
//			$dql = "UPDATE {$this->className} e
//					SET e.{$field} = e.{$field} - {$size}
//					WHERE e.{$field} >= {$offset}";
//
//			$dql .= $this->getAdditionalCondition('AND');
//
//			$query = $this->entityManager->createQuery($dql);
//			$query->execute();
		}

		$this->arrayHelper->truncate($offset, $size);
	}
1062015
private void truncate(BatchExecutor batchExecutor, MappingConfig config) throws SQLException {
        DbMapping dbMapping = config.getDbMapping();
        StringBuilder sql = new StringBuilder();
        sql.append("TRUNCATE TABLE ").append(SyncUtil.getDbTableName(dbMapping));
        batchExecutor.execute(sql.toString(), new ArrayList<>());
        if (logger.isTraceEnabled()) {
            logger.trace("Truncate target table, sql: {}", sql);
        }
    }
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);
    }
546273
public static function flushAll()
    {
        try {
            return static::getDb()->createCommand()->truncateTable(static::tableName())->execute();
        } catch (Exception $e) {
            if (YII_ENV_DEV) {
                throw $e;
            }
        }
    }
961828
public function truncate($table = '')
    {
        // if table name not pass
        if (!empty($table)) {
            // create count query
            $this->sql = "TRUNCATE TABLE `$table`;";
            // pdo prepare statement
            $this->STH = $this->prepare($this->sql);

            try {
                if ($this->STH->execute()) {
                    // close pdo
                    $this->STH->closeCursor();
                    // return number of count
                    return true;
                } else {
                    self::error($this->STH->errorInfo());
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            }
        } else {
            self::error('Table name not found..');
        }
    }
514204
def truncate(self, table):
        """"""
        if isinstance(table, (list, set, tuple)):
            for t in table:
                self._truncate(t)
        else:
            self._truncate(table)
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());
    }
595552
public function truncateTable(string $tableName)
    {
        $partions = $this->partitions($tableName);
        $out      = [];
        foreach ($partions as $part_key => $part) {
            $part_id       = $part['partition'];
            $out[$part_id] = $this->dropPartition($tableName, $part_id);
        }

        return $out;
    }
637081
def truncate_table(self, tablename):
        
        self.get(tablename).remove()
        self.db.commit()
241870
protected function truncateTable()
    {
        if ($this->objectManager instanceof \Doctrine\ORM\EntityManager) {
            $tableName = $this->objectMetadata->table['name'];
            $connection = $this->objectManager->getConnection();
            $query = $connection->getDatabasePlatform()->getTruncateTableSQL($tableName, true);
            $connection->executeQuery($query);
        } elseif ($this->objectManager instanceof \Doctrine\ODM\MongoDB\DocumentManager) {
            $this->objectManager->getDocumentCollection($this->objectName)->remove(array());
        }
    }
1284103
public function truncateTable( $table )
    {
        $query = "DELETE FROM $table";

        $result = $this->execute( $query );

        if ( $result > 0 )
        {
            $this->execute( 'VACUUM' );

            return TRUE;
        }

        return FALSE;
    }
644261
public function delete()
    {
        if (true === $this->getState()->is('new')) {
            throw new \RuntimeException('You cannot delete a new model');
        }
        if (true === $this->getState()->is('deleted')) {
            return $this;
        }
        $this->getState()->setDeleting();
        return $this;
    }
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');
    }
12011
public function drop($table = '')
    {
        $tableName = '';

        $tableName = ($table !== '') ?
            $table : $this->tableName;

        $this->schema = strtoupper(__FUNCTION__).' TABLE IF EXISTS
        `'.$this->database.'`.`'.$tableName.'`'.PHP_EOL;

        return $this;
    }