SQL Server support of numeric type. #3171

Float & real map to float. Numeric & decimal map to numeric.
This commit is contained in:
U-Zyn Chua 2013-09-28 22:48:37 +08:00
parent c74c8d49a1
commit 73cae88a6f

View file

@ -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 @@ class Sqlserver extends DboSource {
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';
}