lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
public function getDefaultValueDeclarationSQL($field)
    {
        if (! isset($field['default'])) {
            return empty($field['notnull']) ? ' DEFAULT NULL' : '';
        }

        $default = $field['default'];

        if (! isset($field['type'])) {
            return " DEFAULT '" . $default . "'";
        }

        $type = $field['type'];

        if ($type instanceof Types\PhpIntegerMappingType) {
            return ' DEFAULT ' . $default;
        }

        if ($type instanceof Types\PhpDateTimeMappingType && $default === $this->getCurrentTimestampSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimestampSQL();
        }

        if ($type instanceof Types\TimeType && $default === $this->getCurrentTimeSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimeSQL();
        }

        if ($type instanceof Types\DateType && $default === $this->getCurrentDateSQL()) {
            return ' DEFAULT ' . $this->getCurrentDateSQL();
        }

        if ($type instanceof Types\BooleanType) {
            return " DEFAULT '" . $this->convertBooleans($default) . "'";
        }

        return ' DEFAULT ' . $this->quoteStringLiteral($default);
    }
public function getDefaultValueDeclarationSQL($field)
    {
        if (! isset($field['default'])) {
            return empty($field['notnull']) ? ' DEFAULT NULL' : '';
        }

        $default = $field['default'];

        if (! isset($field['type'])) {
            return " DEFAULT '" . $default . "'";
        }

        $type = $field['type'];

        if ($type instanceof Types\PhpIntegerMappingType) {
            return ' DEFAULT ' . $default;
        }

        if ($type instanceof Types\PhpDateTimeMappingType && $default === $this->getCurrentTimestampSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimestampSQL();
        }

        if ($type instanceof Types\TimeType && $default === $this->getCurrentTimeSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimeSQL();
        }

        if ($type instanceof Types\DateType && $default === $this->getCurrentDateSQL()) {
            return ' DEFAULT ' . $this->getCurrentDateSQL();
        }

        if ($type instanceof Types\BooleanType) {
            return " DEFAULT '" . $this->convertBooleans($default) . "'";
        }

        return ' DEFAULT ' . $this->quoteStringLiteral($default);
    }
public function getDefaultValueDeclarationSQL ( $ field ) { if ( ! isset ( $ field [ 'default' ] ) ) { return empty ( $ field [ 'notnull' ] ) ? ' DEFAULT NULL' : '' ; } $ default = $ field [ 'default' ] ; if ( ! isset ( $ field [ 'type' ] ) ) { return " DEFAULT '" . $ default . "'" ; } $ type = $ field [ 'type' ] ; if ( $ type instanceof Types \ PhpIntegerMappingType ) { return ' DEFAULT ' . $ default ; } if ( $ type instanceof Types \ PhpDateTimeMappingType && $ default === $ this -> getCurrentTimestampSQL ( ) ) { return ' DEFAULT ' . $ this -> getCurrentTimestampSQL ( ) ; } if ( $ type instanceof Types \ TimeType && $ default === $ this -> getCurrentTimeSQL ( ) ) { return ' DEFAULT ' . $ this -> getCurrentTimeSQL ( ) ; } if ( $ type instanceof Types \ DateType && $ default === $ this -> getCurrentDateSQL ( ) ) { return ' DEFAULT ' . $ this -> getCurrentDateSQL ( ) ; } if ( $ type instanceof Types \ BooleanType ) { return " DEFAULT '" . $ this -> convertBooleans ( $ default ) . "'" ; } return ' DEFAULT ' . $ this -> quoteStringLiteral ( $ default ) ; }
Obtains DBMS specific SQL code portion needed to set a default value
declaration to be used in statements like CREATE TABLE.

@param mixed[] $field The field definition array.

@return string DBMS specific SQL code portion needed to set a default value.
Obtains DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE .