summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/drivers/DB_odbc.php69
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