Skip to content

Commit

Permalink
Adding support for SQLServer's datetime2 column,
Browse files Browse the repository at this point in the history
as that is the preferred datetime format in SQLServer.
  • Loading branch information
markstory committed Jun 22, 2011
1 parent d45b7fa commit a825d82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/Cake/Model/Datasource/Database/Sqlserver.php
Expand Up @@ -238,7 +238,6 @@ public function describe($model) {
$fields[$field]['length'] = $fields[$field]['length'] . ',' . $column->Size;
}
}
debug($fields);
$this->__cacheDescription($table, $fields);
$cols->closeCursor();
return $fields;
Expand Down
17 changes: 16 additions & 1 deletion lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
Expand Up @@ -402,7 +402,16 @@ public function testDescribe() {
'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;
Expand All @@ -419,6 +428,12 @@ public function testDescribe() {
'null' => true,
'default' => null,
'length' => null
),
'published' => array(
'type' => 'datetime',
'null' => true,
'default' => '',
'length' => null
)
);
$this->assertEqual($expected, $result);
Expand Down

0 comments on commit a825d82

Please sign in to comment.