From af4d55da04b8d8750b59e04e46463d525237b74b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 16:22:35 +0300 Subject: Fix issue #861 (and previous commit, for that matter) --- system/database/drivers/mssql/mssql_forge.php | 3 +-- system/database/drivers/sqlsrv/sqlsrv_forge.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'system/database/drivers') diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 5454e37b3..e6227e189 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -67,11 +67,10 @@ class CI_DB_mssql_forge extends CI_DB_forge { else { $attributes = array_change_key_case($attributes, CASE_UPPER); - $attributes['TYPE'] = preg_replace('/(INT)\(\d+\)/i', '$1', $attributes['TYPE']); $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE']; - if (array_key_exists('CONSTRAINT', $attributes)) + if (stripos($attributes['TYPE'], 'INT') === FALSE && ! empty($attributes['CONSTRAINT'])) { $sql .= '('.$attributes['CONSTRAINT'].')'; } diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index bd107476e..d8b5193fa 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -67,11 +67,10 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { else { $attributes = array_change_key_case($attributes, CASE_UPPER); - $attributes['TYPE'] = preg_replace('/(INT)\(\d+\)/i', '$1', $attributes['TYPE']); $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE']; - if (array_key_exists('CONSTRAINT', $attributes)) + if (stripos($attributes['TYPE'], 'INT') === FALSE && ! empty($attributes['CONSTRAINT'])) { $sql .= '('.$attributes['CONSTRAINT'].')'; } -- cgit v1.2.3-24-g4f1b