introduce new tinyint, smallint types for smaller storage requirements

This commit is contained in:
Sebastien Barre 2017-03-05 12:25:14 -05:00
parent 216ae0ec0c
commit 38101995b4
9 changed files with 79 additions and 128 deletions

View file

@ -84,6 +84,8 @@ class Sqlserver extends DboSource {
/**
* MS SQL column definition
*
* @link https://msdn.microsoft.com/en-us/library/ms187752.aspx SQL Server Data Types
*
* @var array
*/
public $columns = array(
@ -91,6 +93,8 @@ class Sqlserver extends DboSource {
'string' => array('name' => 'nvarchar', 'limit' => '255'),
'text' => array('name' => 'nvarchar', 'limit' => 'MAX'),
'integer' => array('name' => 'int', 'formatter' => 'intval'),
'smallint' => array('name' => 'smallint', 'formatter' => 'intval'),
'tinyint' => array('name' => 'tinyint', 'formatter' => 'intval'),
'biginteger' => array('name' => 'bigint'),
'numeric' => array('name' => 'decimal', 'formatter' => 'floatval'),
'decimal' => array('name' => 'decimal', 'formatter' => 'floatval'),
@ -435,6 +439,12 @@ class Sqlserver extends DboSource {
if (strpos($col, 'bigint') !== false) {
return 'biginteger';
}
if (strpos($col, 'smallint') !== false) {
return 'smallint';
}
if (strpos($col, 'tinyint') !== false) {
return 'tinyint';
}
if (strpos($col, 'int') !== false) {
return 'integer';
}