From fdd928182d6691ed2073f6f3a90427157007f54b Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 6 Sep 2006 01:57:41 +0000 Subject: --- system/drivers/DB_odbc.php | 69 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) (limited to 'system') 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 -- cgit v1.2.3-24-g4f1b