get drop table sql
@param  string $table
@return string
185050
public function getDropTableSql($table)
    {
        $table = $this->buildRealTableName($table);
        return $this->getSchema()->getDropTableSql($table);
    }
844778
public function buildDeleteSQL($table = null)
	{
		$sql = 'delete from ' . $this->parseTable($table) . ' ';
		$where = $this->parseCondition(isset($this->operationOption['where']) ? $this->operationOption['where'] : '');
		if ('' !== $where)
		{
			$where = 'where ' . $where . ' ';
		}
		return $sql
				. $where
				. $this->parseOrder()
				. $this->parseLimit()
				. $this->parseLock()
				;
	}
640220
public function tableName($table=null)
	{
		if(null === $table)
		{
			return $this->prefix . $this->table;
		}
		else
		{
			return $this->prefix . $table;
		}
	}
1302234
protected function fetchIndexesDb($table = '') {
        $indexes = [];

        $indexInfos = $this->query('pragma index_list('.$this->prefixTable($table).')')->fetchAll(PDO::FETCH_ASSOC);
        foreach ($indexInfos as $row) {
            $indexName = $row['name'];
            if ($row['unique']) {
                $type = Db::INDEX_UNIQUE;
            } else {
                $type = Db::INDEX_IX;
            }

            // Query the columns in the index.
            $columns = $this->query('pragma index_info('.$this->quote($indexName).')')->fetchAll(PDO::FETCH_ASSOC);

            $index = [
                'name' => $indexName,
                'columns' => array_column($columns, 'name'),
                'type' => $type
            ];
            $indexes[] = $index;
        }

        return $indexes;
    }
577126
protected static function getCreateTableSql($table)
    {
        $db = Yii::$app->db;
        $row = $db->createCommand('SHOW CREATE TABLE ' . $db->schema->quoteTableName($table->fullName))->queryOne();
        if (isset($row['Create Table'])) {
            $sql = $row['Create Table'];
        } else {
            $row = array_values($row);
            $sql = $row[1];
        }

        return $sql;
    }
285023
protected function getDropPrimaryKeySql($table, $name)
	{
		$sql = 'ALTER TABLE ONLY ' . $this->db->quoteName($table) . ' DROP CONSTRAINT ' . $this->db->quoteName($name);

		return $sql;
	}
1373563
public function table($table)
    {
        $processor = $this->getPostProcessor();

        $query = new MbDatabaseQueryBuilder($this, $this->getQueryGrammar(), $processor);

        return $query->from($table);
    }
296521
protected function fetchIndexesDb($table = '') {
        $stm = $this->get(
            new Identifier('information_schema', 'STATISTICS'),
            [
                'TABLE_SCHEMA' => $this->getDbName(),
                'TABLE_NAME' => $this->prefixTable($table, false)
            ],
            [
                'columns' => [
                    'INDEX_NAME',
                    'COLUMN_NAME',
                    'NON_UNIQUE'
                ],
                'order' => ['INDEX_NAME', 'SEQ_IN_INDEX']
            ]
        );
        $indexRows = $stm->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);

        $indexes = [];
        foreach ($indexRows as $indexName => $columns) {
            $index = [
                'type' => null,
                'columns' => array_column($columns, 'COLUMN_NAME'),
                'name' => $indexName
            ];

            if ($indexName === 'PRIMARY') {
                $index['type'] = Db::INDEX_PK;
            } else {
                $index['type'] = $columns[0]['NON_UNIQUE'] ? Db::INDEX_IX : Db::INDEX_UNIQUE;
            }
            $indexes[] = $index;
        }

        return $indexes;
    }
842623
public function getLastInsertID($table)
	{
		$this->ensureTable($table);
		if($table->sequenceName!==null)
			return $this->_connection->getLastInsertID($table->sequenceName);
		else
			return null;
	}
586777
public function getColmuns($table)
    {
        $table = self::table($table);
        $columns = [];
        //
        $data = Database::read("select COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '".Config::get('database.database')."' AND TABLE_NAME = '$table';");
        //
        foreach ($data as $key => $value) {
            $columns[] = $value['COLUMN_NAME'];
        }
        //
        return $columns;
    }
651887
public function getDropIndexSQL($index, $table = null)
    {
        if ($index instanceof Index) {
            $index = $index->getQuotedName($this);
        } elseif (! is_string($index)) {
            throw new InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
        }

        return 'DROP INDEX ' . $index;
    }
1255017
protected function getDropKeySql($table, $name)
	{
		$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' DROP KEY ' . $this->db->quoteName($name);

		return $sql;
	}
816059
protected function getTableDatabase($table)
    {
        if (!array_key_exists($table, $this->tables)) {
            return false;
        }

        $database = $this->tables[$table];

        # If this table's database depends on the mode
        if (is_array($database)) {
            if (array_key_exists($this->mode, $database)) {
                $database = $database[$this->mode];
            } else {
                $database = $database["default"];
            }
        }

        return $database;
    }
27742
public function getDropPrimaryKeyDDL(Table $table)
    {
        $pattern = "
ALTER TABLE %s DROP CONSTRAINT %s;
";

        return sprintf($pattern,
            $this->quoteIdentifier($table->getName()),
            $this->quoteIdentifier($this->getPrimaryKeyName($table))
        );
    }
343237
public function trimTableSelector($table)
    {
        if (is_array($table)) {
            foreach ($table as $key => $value) {
                $table[$key] = $this->trimTableSelector($value);
            }
            return $table;
        } elseif (is_object($table)) {
            foreach (get_object_vars($table) as $key => $value) {
                $table->{$key} = $this->trimTableSelector($value);
            }
            return $table;
        }
        if (is_string($table)) {
            $tableArray = explode('.', $table);
            foreach ($tableArray as $key => $value) {
                $tableArray[$key] = trim(
                    trim(
                        trim($value),
                        $this->currentQuoteIdentifier
                    )
                );
            }
            $table = implode('.', $tableArray);
        }

        return $table;
    }
1021543
protected function _fetchTableInfo($table)
    {
        $result = null;
        $sql    = $this->quoteValue($this->getTableNeedle().$table);

        if ($info  = $this->show('SHOW TABLE STATUS LIKE '.$sql, AnDatabase::FETCH_OBJECT)) {
            //Parse the table raw schema data
            $result = $this->_parseTableInfo($info);
        }

        return $result;
    }
1278249
public function truncate( $table ) {
		if ( ! isset( $this->table_defines[ $table ] ) ) {
			return false;
		}

		if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
			return $this->delete( $table, [] );
		}

		$sql = 'TRUNCATE TABLE `' . $this->get_table( $table ) . '`';

		return $this->query( $sql );
	}