Navigation Menu

Skip to content

Commit

Permalink
SQL Server support of numeric type. #3171
Browse files Browse the repository at this point in the history
Float & real map to float. Numeric & decimal map to numeric.
  • Loading branch information
uzyn committed Sep 28, 2013
1 parent c74c8d4 commit 73cae88
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Cake/Model/Datasource/Database/Sqlserver.php
Expand Up @@ -93,7 +93,10 @@ class Sqlserver extends DboSource {
'text' => array('name' => 'nvarchar', 'limit' => 'MAX'),
'integer' => array('name' => 'int', 'formatter' => 'intval'),
'biginteger' => array('name' => 'bigint'),
'float' => array('name' => 'numeric', 'formatter' => 'floatval'),
'numeric' => array('name' => 'decimal', 'formatter' => 'floatval'),
'decimal' => array('name' => 'decimal', 'formatter' => 'floatval'),
'float' => array('name' => 'float', 'formatter' => 'floatval'),
'real' => array('name' => 'float', 'formatter' => 'floatval'),
'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'time' => array('name' => 'datetime', 'format' => 'H:i:s', 'formatter' => 'date'),
Expand Down Expand Up @@ -441,9 +444,12 @@ public function column($real) {
if (strpos($col, 'binary') !== false || $col === 'image') {
return 'binary';
}
if (in_array($col, array('float', 'real', 'decimal', 'numeric'))) {
if (in_array($col, array('float', 'real'))) {
return 'float';
}
if (in_array($col, array('decimal', 'numeric'))) {
return 'decimal';
}
return 'text';
}

Expand Down

0 comments on commit 73cae88

Please sign in to comment.