summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv
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/sqlsrv
parent822e74ee39fffd2c35477be2bedfb37e78eb3bc1 (diff)
Improve DB field_data() for Oracle (and fix its max_length for MSSQL / SQLSRV)
Diffstat (limited to 'system/database/drivers/sqlsrv')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 1e182958c..3f193558a 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -325,7 +325,9 @@ class CI_DB_sqlsrv_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);
}
// --------------------------------------------------------------------
@@ -359,7 +361,7 @@ class CI_DB_sqlsrv_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;
}