db =& $db; $this->nrows = oci_fetch_all( $stmt, $this->rows, 0, -1, OCI_FETCHSTATEMENT_BY_ROW | OCI_NUM ); if ( $this->nrows === false ) { $e = oci_error( $stmt ); $db->reportQueryError( $e['message'], $e['code'], '', __METHOD__ ); $this->free(); return; } if ( $unique ) { $this->rows = $this->array_unique_md( $this->rows ); $this->nrows = count( $this->rows ); } if ( $this->nrows > 0 ) { foreach ( $this->rows[0] as $k => $v ) { $this->columns[$k] = strtolower( oci_field_name( $stmt, $k + 1 ) ); } } $this->cursor = 0; oci_free_statement( $stmt ); } public function free() { unset( $this->db ); } public function seek( $row ) { $this->cursor = min( $row, $this->nrows ); } public function numRows() { return $this->nrows; } public function numFields() { return count( $this->columns ); } public function fetchObject() { if ( $this->cursor >= $this->nrows ) { return false; } $row = $this->rows[$this->cursor++]; $ret = new stdClass(); foreach ( $row as $k => $v ) { $lc = $this->columns[$k]; $ret->$lc = $v; } return $ret; } public function fetchRow() { if ( $this->cursor >= $this->nrows ) { return false; } $row = $this->rows[$this->cursor++]; $ret = []; foreach ( $row as $k => $v ) { $lc = $this->columns[$k]; $ret[$lc] = $v; $ret[$k] = $v; } return $ret; } }