yii\db\oci\Schema::extractColumnType PHP Method

extractColumnType() protected method

Extracts the data types for the given column
protected extractColumnType ( ColumnSchema $column, string $dbType, string $precision, string $scale, string $length )
$column yii\db\ColumnSchema
$dbType string DB type
$precision string total number of digits. This parameter is available since version 2.0.4.
$scale string number of digits on the right of the decimal separator. This parameter is available since version 2.0.4.
$length string length for character types. This parameter is available since version 2.0.4.
    protected function extractColumnType($column, $dbType, $precision, $scale, $length)
    {
        $column->dbType = $dbType;
        if (strpos($dbType, 'FLOAT') !== false || strpos($dbType, 'DOUBLE') !== false) {
            $column->type = 'double';
        } elseif (strpos($dbType, 'NUMBER') !== false) {
            if ($scale === null || $scale > 0) {
                $column->type = 'decimal';
            } else {
                $column->type = 'integer';
            }
        } elseif (strpos($dbType, 'INTEGER') !== false) {
            $column->type = 'integer';
        } elseif (strpos($dbType, 'BLOB') !== false) {
            $column->type = 'binary';
        } elseif (strpos($dbType, 'CLOB') !== false) {
            $column->type = 'text';
        } elseif (strpos($dbType, 'TIMESTAMP') !== false) {
            $column->type = 'timestamp';
        } else {
            $column->type = 'string';
        }
    }