yii\db\mysql\QueryBuilder::getColumnDefinition PHP Method

getColumnDefinition() private method

Gets column definition.
private getColumnDefinition ( string $table, string $column ) : null | string
$table string table name
$column string column name
return null | string the column definition
    private function getColumnDefinition($table, $column)
    {
        $quotedTable = $this->db->quoteTableName($table);
        $row = $this->db->createCommand('SHOW CREATE TABLE ' . $quotedTable)->queryOne();
        if ($row === false) {
            throw new Exception("Unable to find column '{$column}' in table '{$table}'.");
        }
        if (isset($row['Create Table'])) {
            $sql = $row['Create Table'];
        } else {
            $row = array_values($row);
            $sql = $row[1];
        }
        if (preg_match_all('/^\\s*`(.*?)`\\s+(.*?),?$/m', $sql, $matches)) {
            foreach ($matches[1] as $i => $c) {
                if ($c === $column) {
                    return $matches[2][$i];
                }
            }
        }
        return null;
    }