Skip to content

Instantly share code, notes, and snippets.

@nickvergessen
Created August 4, 2017 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickvergessen/d9f83cc3a8c9bcb8b5cd13922acae332 to your computer and use it in GitHub Desktop.
Save nickvergessen/d9f83cc3a8c9bcb8b5cd13922acae332 to your computer and use it in GitHub Desktop.
diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
index 21b06fa1..ee3af635 100644
--- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+++ b/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
@@ -81,6 +81,11 @@ class OCI8Statement implements \IteratorAggregate, Statement
private $boundValues = array();
/**
+ * @var int|null
+ */
+ private $rowCount = null;
+
+ /**
* Creates a new OCI8Statement that uses the given connection handle and SQL statement.
*
* @param resource $dbh The connection handle.
@@ -316,6 +321,10 @@ class OCI8Statement implements \IteratorAggregate, Statement
*/
public function rowCount()
{
- return oci_num_rows($this->_sth);
+ if ($this->rowCount === null) {
+ $this->rowCount = oci_num_rows($this->_sth);
+ $this->closeCursor();
+ }
+ return $this->rowCount;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment