-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\r
-/**\r
- * CodeIgniter\r
- *\r
- * An open source application development framework for PHP 4.3.2 or newer\r
- *\r
- * @package CodeIgniter\r
- * @author ExpressionEngine Dev Team\r
- * @copyright Copyright (c) 2008, EllisLab, Inc.\r
- * @license http://codeigniter.com/user_guide/license.html\r
- * @link http://codeigniter.com\r
- * @since Version 1.0\r
- * @filesource\r
- */\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * oci8 Result Class\r
- *\r
- * This class extends the parent result class: CI_DB_result\r
- *\r
- * @category Database\r
- * @author ExpressionEngine Dev Team\r
- * @link http://codeigniter.com/user_guide/database/\r
- */\r
-class CI_DB_oci8_result extends CI_DB_result {\r
-\r
- var $stmt_id;\r
- var $curs_id;\r
- var $limit_used;\r
-\r
- /**\r
- * Number of rows in the result set.\r
- *\r
- * Oracle doesn't have a graceful way to retun the number of rows\r
- * so we have to use what amounts to a hack.\r
- * \r
- *\r
- * @access public\r
- * @return integer\r
- */\r
- function num_rows()\r
- {\r
- $rowcount = count($this->result_array());\r
- @ociexecute($this->stmt_id);\r
-\r
- if ($this->curs_id)\r
- {\r
- @ociexecute($this->curs_id);\r
- }\r
-\r
- return $rowcount;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Number of fields in the result set\r
- *\r
- * @access public\r
- * @return integer\r
- */\r
- function num_fields()\r
- {\r
- $count = @ocinumcols($this->stmt_id);\r
-\r
- // if we used a limit we subtract it\r
- if ($this->limit_used)\r
- {\r
- $count = $count - 1;\r
- }\r
-\r
- return $count;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Fetch Field Names\r
- *\r
- * Generates an array of column names\r
- *\r
- * @access public\r
- * @return array\r
- */\r
- function list_fields()\r
- {\r
- $field_names = array();\r
- $fieldCount = $this->num_fields();\r
- for ($c = 1; $c <= $fieldCount; $c++)\r
- {\r
- $field_names[] = ocicolumnname($this->stmt_id, $c);\r
- }\r
- return $field_names;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Field data\r
- *\r
- * Generates an array of objects containing field meta-data\r
- *\r
- * @access public\r
- * @return array\r
- */\r
- function field_data()\r
- {\r
- $retval = array();\r
- $fieldCount = $this->num_fields();\r
- for ($c = 1; $c <= $fieldCount; $c++)\r
- {\r
- $F = new stdClass();\r
- $F->name = ocicolumnname($this->stmt_id, $c);\r
- $F->type = ocicolumntype($this->stmt_id, $c);\r
- $F->max_length = ocicolumnsize($this->stmt_id, $c);\r
-\r
- $retval[] = $F;\r
- }\r
-\r
- return $retval;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Free the result\r
- *\r
- * @return null\r
- */ \r
- function free_result()\r
- {\r
- if (is_resource($this->result_id))\r
- {\r
- ocifreestatement($this->result_id); \r
- $this->result_id = FALSE;\r
- }\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Result - associative array\r
- *\r
- * Returns the result set as an array\r
- *\r
- * @access private\r
- * @return array\r
- */\r
- function _fetch_assoc(&$row)\r
- {\r
- $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;\r
- \r
- return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); \r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Result - object\r
- *\r
- * Returns the result set as an object\r
- *\r
- * @access private\r
- * @return object\r
- */\r
- function _fetch_object()\r
- { \r
- $result = array();\r
-\r
- // If PHP 5 is being used we can fetch an result object\r
- if (function_exists('oci_fetch_object'))\r
- {\r
- $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;\r
- \r
- return @oci_fetch_object($id);\r
- }\r
- \r
- // If PHP 4 is being used we have to build our own result\r
- foreach ($this->result_array() as $key => $val)\r
- {\r
- $obj = new stdClass();\r
- if (is_array($val))\r
- {\r
- foreach ($val as $k => $v)\r
- {\r
- $obj->$k = $v;\r
- }\r
- }\r
- else\r
- {\r
- $obj->$key = $val;\r
- }\r
- \r
- $result[] = $obj;\r
- }\r
-\r
- return $result;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Query result. "array" version.\r
- *\r
- * @access public\r
- * @return array\r
- */\r
- function result_array()\r
- {\r
- if (count($this->result_array) > 0)\r
- {\r
- return $this->result_array;\r
- }\r
-\r
- // oracle's fetch functions do not return arrays.\r
- // The information is returned in reference parameters\r
- $row = NULL;\r
- while ($this->_fetch_assoc($row))\r
- {\r
- $this->result_array[] = $row;\r
- }\r
-\r
- return $this->result_array;\r
- }\r
-\r
- // --------------------------------------------------------------------\r
-\r
- /**\r
- * Data Seek\r
- *\r
- * Moves the internal pointer to the desired offset. We call\r
- * this internally before fetching results to make sure the\r
- * result set starts at zero\r
- *\r
- * @access private\r
- * @return array\r
- */\r
- function _data_seek($n = 0)\r
- {\r
- return FALSE; // Not needed\r
- }\r
-\r
-}\r
-\r
-\r
-/* End of file oci8_result.php */\r
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * oci8 Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category Database
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_oci8_result extends CI_DB_result {
+
+ var $stmt_id;
+ var $curs_id;
+ var $limit_used;
+
+ /**
+ * Number of rows in the result set.
+ *
+ * Oracle doesn't have a graceful way to retun the number of rows
+ * so we have to use what amounts to a hack.
+ *
+ *
+ * @access public
+ * @return integer
+ */
+ function num_rows()
+ {
+ $rowcount = count($this->result_array());
+ @ociexecute($this->stmt_id);
+
+ if ($this->curs_id)
+ {
+ @ociexecute($this->curs_id);
+ }
+
+ return $rowcount;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Number of fields in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_fields()
+ {
+ $count = @ocinumcols($this->stmt_id);
+
+ // if we used a limit we subtract it
+ if ($this->limit_used)
+ {
+ $count = $count - 1;
+ }
+
+ return $count;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Fetch Field Names
+ *
+ * Generates an array of column names
+ *
+ * @access public
+ * @return array
+ */
+ function list_fields()
+ {
+ $field_names = array();
+ $fieldCount = $this->num_fields();
+ for ($c = 1; $c <= $fieldCount; $c++)
+ {
+ $field_names[] = ocicolumnname($this->stmt_id, $c);
+ }
+ return $field_names;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data
+ *
+ * Generates an array of objects containing field meta-data
+ *
+ * @access public
+ * @return array
+ */
+ function field_data()
+ {
+ $retval = array();
+ $fieldCount = $this->num_fields();
+ for ($c = 1; $c <= $fieldCount; $c++)
+ {
+ $F = new stdClass();
+ $F->name = ocicolumnname($this->stmt_id, $c);
+ $F->type = ocicolumntype($this->stmt_id, $c);
+ $F->max_length = ocicolumnsize($this->stmt_id, $c);
+
+ $retval[] = $F;
+ }
+
+ return $retval;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Free the result
+ *
+ * @return null
+ */
+ function free_result()
+ {
+ if (is_resource($this->result_id))
+ {
+ ocifreestatement($this->result_id);
+ $this->result_id = FALSE;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - associative array
+ *
+ * Returns the result set as an array
+ *
+ * @access private
+ * @return array
+ */
+ function _fetch_assoc(&$row)
+ {
+ $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
+
+ return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - object
+ *
+ * Returns the result set as an object
+ *
+ * @access private
+ * @return object
+ */
+ function _fetch_object()
+ {
+ $result = array();
+
+ // If PHP 5 is being used we can fetch an result object
+ if (function_exists('oci_fetch_object'))
+ {
+ $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
+
+ return @oci_fetch_object($id);
+ }
+
+ // If PHP 4 is being used we have to build our own result
+ foreach ($this->result_array() as $key => $val)
+ {
+ $obj = new stdClass();
+ if (is_array($val))
+ {
+ foreach ($val as $k => $v)
+ {
+ $obj->$k = $v;
+ }
+ }
+ else
+ {
+ $obj->$key = $val;
+ }
+
+ $result[] = $obj;
+ }
+
+ return $result;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Query result. "array" version.
+ *
+ * @access public
+ * @return array
+ */
+ function result_array()
+ {
+ if (count($this->result_array) > 0)
+ {
+ return $this->result_array;
+ }
+
+ // oracle's fetch functions do not return arrays.
+ // The information is returned in reference parameters
+ $row = NULL;
+ while ($this->_fetch_assoc($row))
+ {
+ $this->result_array[] = $row;
+ }
+
+ return $this->result_array;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Data Seek
+ *
+ * Moves the internal pointer to the desired offset. We call
+ * this internally before fetching results to make sure the
+ * result set starts at zero
+ *
+ * @access private
+ * @return array
+ */
+ function _data_seek($n = 0)
+ {
+ return FALSE; // Not needed
+ }
+
+}
+
+
+/* End of file oci8_result.php */
/* Location: ./system/database/drivers/oci8/oci8_result.php */
\ No newline at end of file