Commit ef02cc72 authored by David Desberg's avatar David Desberg Committed by Benjamin Eberlei

Applied stof's suggestions

parent 2e9e9156
...@@ -896,31 +896,32 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -896,31 +896,32 @@ class SQLServerPlatform extends AbstractPlatform
{ {
return 'VARBINARY(MAX)'; return 'VARBINARY(MAX)';
} }
/** /**
* Obtain DBMS specific SQL code portion needed to set a default value * {@inheritDoc}
* declaration to be used in statements like CREATE TABLE. */
*
* @param array $field field definition array
*
* @return string DBMS specific SQL code portion needed to set a default value
*/
public function getDefaultValueDeclarationSQL($field) public function getDefaultValueDeclarationSQL($field)
{ {
$default = empty($field['notnull']) ? ' NULL' : ''; if ( ! isset($field['default'])) {
return empty($field['notnull']) ? ' NULL' : '';
if (isset($field['default'])) { }
$default = " DEFAULT '".$field['default']."'";
if (isset($field['type'])) { if ( ! isset($field['type'])) {
if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) { return " DEFAULT '" . $field['default'] . "'";
$default = " DEFAULT ".$field['default'];
} else if ((string)$field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
$default = " DEFAULT ".$this->getCurrentTimestampSQL();
} else if ((string) $field['type'] == 'Boolean') {
$default = " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
}
}
} }
return $default;
if (in_array((string) $field['type'], array('Integer', 'BigInteger', 'SmallInteger'))) {
return " DEFAULT " . $field['default'];
}
if ((string) $field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
return " DEFAULT " . $this->getCurrentTimestampSQL();
}
if ((string) $field['type'] == 'Boolean') {
return " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
}
return " DEFAULT '" . $field['default'] . "'";
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment