protected function setNumRows() { // oci_num_rows will return the number of fetched rows so far for a SELECT statement // for all other query types this is fine // If the user has fetched records in a while loop, the num rows will be the amount of rows fetched so far. // When the user hasn't fetched anything yet, we will fetch the complete result and return the count. $this->numRows = oci_num_rows($this->statement->getResource()); if ($this->statement->getStatementType() == 'SELECT' && empty($this->numRows)) { $this->fetchAll(); // unlike fetchResult, this will only fetch the result when result is empty $this->numRows = $this->result->count(); } }