summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mssql
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-09 13:37:16 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-09 13:37:16 +0100
commit242500d51695e4177ec99a3221086f51f55c8862 (patch)
tree9d341a1ef94a97c1a5f8818e4103312e022927fa /system/database/drivers/mssql
parente00ee42d2b6f1540bee1ae1bee7dbc3232c58d5e (diff)
parentc016a1102e2a77e0c27b9656c19a0460df24dfb6 (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers/mssql')
-rw-r--r--system/database/drivers/mssql/mssql_driver.php26
-rw-r--r--system/database/drivers/mssql/mssql_forge.php3
2 files changed, 10 insertions, 19 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index cb73dda27..4d656f16e 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -333,7 +333,7 @@ class CI_DB_mssql_driver extends CI_DB {
return 0;
}
- $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows').' FROM '.$this->_protect_identifiers($table, TRUE, NULL, FALSE));
+ $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE));
if ($query->num_rows() == 0)
{
return 0;
@@ -401,26 +401,18 @@ class CI_DB_mssql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * The error message string
+ * Error
*
- * @return string
- */
- protected function _error_message()
- {
- return mssql_get_last_message();
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message number
+ * Returns an array containing code and message of the last
+ * database error that has occured.
*
- * @return string
+ * @return array
*/
- protected function _error_number()
+ public function error()
{
- // Not supported in MSSQL
- return '';
+ $query = $this->query('SELECT @@ERROR AS code');
+ $query = $query->row();
+ return array('code' => $query->code, 'message' => mssql_get_last_message());
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index 59b930c2f..907e7e737 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -126,8 +126,7 @@ class CI_DB_mssql_forge extends CI_DB_forge {
if (count($primary_keys) > 0)
{
- $primary_keys = $this->db->protect_identifiers($primary_keys);
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)