summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mssql/mssql_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-16 15:17:54 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-16 15:17:54 +0100
commite1580571d2b7777bb815b0ab57279c625c182997 (patch)
tree9c829452b9b0645b27f1ca133ed6a856805637ef /system/database/drivers/mssql/mssql_driver.php
parent822e74ee39fffd2c35477be2bedfb37e78eb3bc1 (diff)
Improve DB field_data() for Oracle (and fix its max_length for MSSQL / SQLSRV)
Diffstat (limited to 'system/database/drivers/mssql/mssql_driver.php')
-rw-r--r--system/database/drivers/mssql/mssql_driver.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 0ae8d7b6a..e081de4e8 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -344,7 +344,9 @@ class CI_DB_mssql_driver extends CI_DB {
*/
protected function _list_columns($table = '')
{
- return "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";
+ return 'SELECT COLUMN_NAME
+ FROM INFORMATION_SCHEMA.Columns
+ WHERE TABLE_NAME = '.$this->escape($table);
}
// --------------------------------------------------------------------
@@ -378,7 +380,7 @@ class CI_DB_mssql_driver extends CI_DB {
$retval[$i] = new stdClass();
$retval[$i]->name = $query[$i]->COLUMN_NAME;
$retval[$i]->type = $query[$i]->DATA_TYPE;
- $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->NUMERIC_PRECISION : $query[$i]->CHARACTER_MAXIMUM_LENGTH;
+ $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION;
$retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
}