Permalink
Browse files

SQL Server support of numeric type. #3171

Float & real map to float. Numeric & decimal map to numeric.
  • Loading branch information...
uzyn committed Sep 28, 2013
1 parent c74c8d4 commit 73cae88a6f959f9386b220fa0caff30ac8212043
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -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'),
@@ -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';
}

0 comments on commit 73cae88

Please sign in to comment.