diff options
author | admin <devnull@localhost> | 2006-09-06 03:57:41 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-06 03:57:41 +0200 |
commit | fdd928182d6691ed2073f6f3a90427157007f54b (patch) | |
tree | f36335f2a88e4d5a4b1559d4e5835b2166a77a45 /system | |
parent | 1066dcb279e26de29fd663d61957dfcd1f939f9a (diff) |
Diffstat (limited to 'system')
-rw-r--r-- | system/drivers/DB_odbc.php | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/system/drivers/DB_odbc.php b/system/drivers/DB_odbc.php index 50f39accd..a5a8db64d 100644 --- a/system/drivers/DB_odbc.php +++ b/system/drivers/DB_odbc.php @@ -445,9 +445,16 @@ class CI_DB_odbc_result extends CI_DB_result { */ function _fetch_assoc() { - return odbc_fetch_array($this->result_id); + if (function_exists('odbc_fetch_object')) + { + return odbc_fetch_array($this->result_id); + } + else + { + return $this->_odbc_fetch_array($this->result_id); + } } - + // -------------------------------------------------------------------- /** @@ -460,9 +467,63 @@ class CI_DB_odbc_result extends CI_DB_result { */ function _fetch_object() { - return odbc_fetch_object($this->result_id); + if (function_exists('odbc_fetch_object')) + { + return odbc_fetch_object($this->result_id); + } + else + { + return $this->_odbc_fetch_object($this->result_id); + } } - + + + /** + * Result - object + * + * subsititutes the odbc_fetch_object function when + * not available (odbc_fetch_object requires unixODBC) + * + * @access private + * @return object + */ + + function _odbc_fetch_object(& $odbc_result) { + $rs = array(); + $rs_obj = false; + 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 $rs_obj; + } + + + /** + * Result - array + * + * subsititutes the odbc_fetch_array function when + * not available (odbc_fetch_array requires unixODBC) + * + * @access private + * @return array + */ + + function _odbc_fetch_array(& $odbc_result) { + $rs = array(); + $rs_assoc = false; + 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 $rs_assoc; + } + } ?>
\ No newline at end of file |