mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Fixing "DEFAULT NULL" sentence, which for some reason does not work. It needs to be only "NULL", and "DEFAULT NULL NULL" works too.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8263 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ee8d12c939
commit
90445e9119
2 changed files with 7 additions and 3 deletions
|
@ -664,7 +664,11 @@ class DboMssql extends DboSource {
|
|||
* @return string
|
||||
*/
|
||||
function buildColumn($column) {
|
||||
return preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
|
||||
$column = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
|
||||
if (strpos($column, 'DEFAULT NULL') !== null) {
|
||||
$column = str_replace('DEFAULT NULL', 'NULL', $column);
|
||||
}
|
||||
return $column;
|
||||
}
|
||||
/**
|
||||
* Format indexes for create table
|
||||
|
|
|
@ -400,7 +400,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
|
||||
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => true);
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[client_id] int DEFAULT NULL';
|
||||
$expected = '[client_id] int NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255');
|
||||
|
@ -420,7 +420,7 @@ class DboMssqlTest extends CakeTestCase {
|
|||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '255');
|
||||
$result = $this->db->buildColumn($column);
|
||||
$expected = '[name] varchar(255) DEFAULT NULL';
|
||||
$expected = '[name] varchar(255) NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '255');
|
||||
|
|
Loading…
Add table
Reference in a new issue