From 1f26edc61f314a74cd93fcdf688b3780734e0e96 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 16:13:54 +0300 Subject: Added a work-around for MSSQL/SQLSRV create_table() with INT column types (column lengths are not supported) --- system/database/drivers/mssql/mssql_forge.php | 1 + system/database/drivers/sqlsrv/sqlsrv_forge.php | 1 + 2 files changed, 2 insertions(+) (limited to 'system/database/drivers') diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 3708c2233..5454e37b3 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -67,6 +67,7 @@ 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']; diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 1529b2a21..bd107476e 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -67,6 +67,7 @@ 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']; -- cgit v1.2.3-24-g4f1b