summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-09-23 10:39:51 +0200
committerGreg Aker <greg@gregaker.net>2011-09-23 10:39:51 +0200
commit513f9a046aa48ae755cc2667f880c3996efe2f8a (patch)
tree457602addee6b1e6b535ca33a41e338426b6f8ad
parent1ccbb8afa8ab5060d7bdb7a22c640302fe80d226 (diff)
parentef3e2402b22a7687730520971c27bec466b5167d (diff)
Merge pull request #469 from narfbg/ci-issue-182
Fix issue #182: OCI8's num_rows() re-executing the statement
-rw-r--r--system/database/drivers/oci8/oci8_result.php17
-rw-r--r--user_guide/changelog.html1
2 files changed, 11 insertions, 7 deletions
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 88531b436..2713f6f12 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -42,15 +42,18 @@ class CI_DB_oci8_result extends CI_DB_result {
*/
function num_rows()
{
- $rowcount = count($this->result_array());
- @ociexecute($this->stmt_id);
-
- if ($this->curs_id)
+ if ($this->num_rows === 0 && count($this->result_array()) > 0)
{
- @ociexecute($this->curs_id);
+ $this->num_rows = count($this->result_array());
+ @ociexecute($this->stmt_id);
+
+ if ($this->curs_id)
+ {
+ @ociexecute($this->curs_id);
+ }
}
- return $rowcount;
+ return $this->num_rows;
}
// --------------------------------------------------------------------
@@ -246,4 +249,4 @@ class CI_DB_oci8_result extends CI_DB_result {
/* End of file oci8_result.php */
-/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/oci8/oci8_result.php */
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 7742fb8a8..7ff2af2f5 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -131,6 +131,7 @@ Change Log
<li>Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.</li>
<li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li>
<li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li>
+ <li>Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.</li>
</ul>
<h2>Version 2.0.3</h2>