Commit 100192c6 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch '2.3' of github.com:doctrine/dbal into 2.3

parents 9a10bd67 22a30c9c
...@@ -5,7 +5,7 @@ require_once 'Doctrine/Common/ClassLoader.php'; ...@@ -5,7 +5,7 @@ require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine'); $classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register(); $classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine'); $classLoader = new \Doctrine\Common\ClassLoader('Symfony');
$classLoader->register(); $classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php'; $configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
...@@ -19,7 +19,7 @@ if (file_exists($configFile)) { ...@@ -19,7 +19,7 @@ if (file_exists($configFile)) {
} }
require $configFile; require $configFile;
foreach ($GLOBALS as $helperSetCandidate) { foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) { if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate; $helperSet = $helperSetCandidate;
...@@ -40,4 +40,4 @@ $cli->addCommands(array( ...@@ -40,4 +40,4 @@ $cli->addCommands(array(
new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(), new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(),
)); ));
$cli->run(); $cli->run();
\ No newline at end of file
...@@ -896,4 +896,32 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -896,4 +896,32 @@ class SQLServerPlatform extends AbstractPlatform
{ {
return 'VARBINARY(MAX)'; return 'VARBINARY(MAX)';
} }
/**
* {@inheritDoc}
*/
public function getDefaultValueDeclarationSQL($field)
{
if ( ! isset($field['default'])) {
return empty($field['notnull']) ? ' NULL' : '';
}
if ( ! isset($field['type'])) {
return " DEFAULT '" . $field['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'] . "'";
}
} }
...@@ -14,13 +14,13 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase ...@@ -14,13 +14,13 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
public function getGenerateTableSql() public function getGenerateTableSql()
{ {
return 'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255) DEFAULT NULL, PRIMARY KEY (id))'; return 'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255) NULL, PRIMARY KEY (id))';
} }
public function getGenerateTableWithMultiColumnUniqueIndexSql() public function getGenerateTableWithMultiColumnUniqueIndexSql()
{ {
return array( return array(
'CREATE TABLE test (foo NVARCHAR(255) DEFAULT NULL, bar NVARCHAR(255) DEFAULT NULL)', 'CREATE TABLE test (foo NVARCHAR(255) NULL, bar NVARCHAR(255) NULL)',
'CREATE UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA ON test (foo, bar) WHERE foo IS NOT NULL AND bar IS NOT NULL' 'CREATE UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA ON test (foo, bar) WHERE foo IS NOT NULL AND bar IS NOT NULL'
); );
} }
...@@ -28,7 +28,7 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase ...@@ -28,7 +28,7 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
public function getGenerateAlterTableSql() public function getGenerateAlterTableSql()
{ {
return array( return array(
'ALTER TABLE mytable ADD quota INT DEFAULT NULL', 'ALTER TABLE mytable ADD quota INT NULL',
'ALTER TABLE mytable DROP COLUMN foo', 'ALTER TABLE mytable DROP COLUMN foo',
'ALTER TABLE mytable ALTER COLUMN baz NVARCHAR(255) DEFAULT \'def\' NOT NULL', 'ALTER TABLE mytable ALTER COLUMN baz NVARCHAR(255) DEFAULT \'def\' NOT NULL',
'ALTER TABLE mytable ALTER COLUMN bloo BIT DEFAULT \'0\' NOT NULL', 'ALTER TABLE mytable ALTER COLUMN bloo BIT DEFAULT \'0\' NOT NULL',
......
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