Adding support for SQLServer's datetime2 column,

as that is the preferred datetime format in SQLServer.
This commit is contained in:
Mark Story 2011-06-22 10:24:45 -07:00
parent d45b7fa174
commit a825d8280f
2 changed files with 16 additions and 2 deletions

View file

@ -238,7 +238,6 @@ class Sqlserver extends DboSource {
$fields[$field]['length'] = $fields[$field]['length'] . ',' . $column->Size;
}
}
debug($fields);
$this->__cacheDescription($table, $fields);
$cols->closeCursor();
return $fields;

View file

@ -402,7 +402,16 @@ class SqlserverTest extends CakeTestCase {
'Length' => -1,
'Null' => 'YES',
'Type' => 'nvarchar'
)
),
(object) array(
'Default' => '',
'Field' => 'published',
'Key' => 0,
'Type' => 'datetime2',
'Length' => 8,
'Null' => 'YES',
'Size' => ''
),
));
$this->db->executeResultsStack = array($SqlserverTableDescription);
$dummyModel = $this->model;
@ -419,6 +428,12 @@ class SqlserverTest extends CakeTestCase {
'null' => true,
'default' => null,
'length' => null
),
'published' => array(
'type' => 'datetime',
'null' => true,
'default' => '',
'length' => null
)
);
$this->assertEqual($expected, $result);