diff options
author | Anton Lindqvist <anton@qvister.se> | 2012-06-08 10:09:47 +0200 |
---|---|---|
committer | Anton Lindqvist <anton@qvister.se> | 2012-06-08 10:09:47 +0200 |
commit | 94c6b1f1c02466178c1f8e144542d753f27dd3d8 (patch) | |
tree | 8e8ca4b8383e2481b0a689fd07fc230013531822 /system/database/drivers/odbc/odbc_result.php | |
parent | 6581cac4d2b5fef69478ce1a5c3464200bfcbba5 (diff) | |
parent | c78e56a7df140ee777ffc67687877f3e70c77e28 (diff) |
Merge branch 'develop' of https://github.com/EllisLab/CodeIgniter into develop
Conflicts:
system/libraries/Cache/Cache.php
Diffstat (limited to 'system/database/drivers/odbc/odbc_result.php')
-rw-r--r-- | system/database/drivers/odbc/odbc_result.php | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index ecba5977e..227fe4fac 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -59,8 +59,6 @@ class CI_DB_odbc_result extends CI_DB_result { return $this->num_rows; } - // -------------------------------------------------------------------- - /** * Number of fields in the result set * @@ -148,14 +146,9 @@ class CI_DB_odbc_result extends CI_DB_result { */ protected function _fetch_assoc() { - if (function_exists('odbc_fetch_array')) - { - return odbc_fetch_array($this->result_id); - } - else - { - return $this->_odbc_fetch_array($this->result_id); - } + return function_exists('odbc_fetch_array') + ? odbc_fetch_array($this->result_id) + : $this->_odbc_fetch_array($this->result_id); } // -------------------------------------------------------------------- @@ -169,14 +162,9 @@ class CI_DB_odbc_result extends CI_DB_result { */ protected function _fetch_object() { - if (function_exists('odbc_fetch_object')) - { - return odbc_fetch_object($this->result_id); - } - else - { - return $this->_odbc_fetch_object($this->result_id); - } + return function_exists('odbc_fetch_object') + ? odbc_fetch_object($this->result_id) + : $this->_odbc_fetch_object($this->result_id); } // -------------------------------------------------------------------- @@ -192,15 +180,18 @@ class CI_DB_odbc_result extends CI_DB_result { protected function _odbc_fetch_object(& $odbc_result) { $rs = array(); - $rs_obj = FALSE; - if (odbc_fetch_into($odbc_result, $rs)) + if ( ! odbc_fetch_into($odbc_result, $rs)) { - foreach ($rs as $k => $v) - { - $field_name = odbc_field_name($odbc_result, $k+1); - $rs_obj->$field_name = $v; - } + return FALSE; + } + + $rs_obj = new stdClass(); + foreach ($rs as $k => $v) + { + $field_name = odbc_field_name($odbc_result, $k+1); + $rs_obj->$field_name = $v; } + return $rs_obj; } @@ -217,16 +208,18 @@ class CI_DB_odbc_result extends CI_DB_result { protected function _odbc_fetch_array(& $odbc_result) { $rs = array(); - $rs_assoc = FALSE; - if (odbc_fetch_into($odbc_result, $rs)) + if ( ! odbc_fetch_into($odbc_result, $rs)) { - $rs_assoc = array(); - foreach ($rs as $k => $v) - { - $field_name = odbc_field_name($odbc_result, $k+1); - $rs_assoc[$field_name] = $v; - } + return FALSE; + } + + $rs_assoc = array(); + foreach ($rs as $k => $v) + { + $field_name = odbc_field_name($odbc_result, $k+1); + $rs_assoc[$field_name] = $v; } + return $rs_assoc; } |