X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=includes%2Fdb%2FDatabaseOracle.php;h=a123d00f27d201b3a482a6ab2f032db70914873c;hb=a830c14d0b5c572709817ae7155a0d0ae5939436;hp=4af62a0b05e5af80be2523be6c1b8c106024d483;hpb=0dda44c8e7e54ab897447954d5c4174513ce7586;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 4af62a0b05..a123d00f27 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -178,7 +178,7 @@ class DatabaseOracle extends Database { } function execFlags() { - return $this->trxLevel ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS; + return $this->trxLevel() ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS; } /** @@ -253,11 +253,7 @@ class DatabaseOracle extends Database { * @param IResultWrapper|ORAResult $res */ function freeResult( $res ) { - if ( $res instanceof ResultWrapper ) { - $res = $res->result; - } - - $res->free(); + ResultWrapper::unwrap( $res )->free(); } /** @@ -265,11 +261,7 @@ class DatabaseOracle extends Database { * @return stdClass|bool */ function fetchObject( $res ) { - if ( $res instanceof ResultWrapper ) { - $res = $res->result; - } - - return $res->fetchObject(); + return ResultWrapper::unwrap( $res )->fetchObject(); } /** @@ -277,11 +269,7 @@ class DatabaseOracle extends Database { * @return stdClass|bool */ function fetchRow( $res ) { - if ( $res instanceof ResultWrapper ) { - $res = $res->result; - } - - return $res->fetchRow(); + return ResultWrapper::unwrap( $res )->fetchRow(); } /** @@ -289,11 +277,7 @@ class DatabaseOracle extends Database { * @return int */ function numRows( $res ) { - if ( $res instanceof ResultWrapper ) { - $res = $res->result; - } - - return $res->numRows(); + return ResultWrapper::unwrap( $res )->numRows(); } /** @@ -301,11 +285,7 @@ class DatabaseOracle extends Database { * @return int */ function numFields( $res ) { - if ( $res instanceof ResultWrapper ) { - $res = $res->result; - } - - return $res->numFields(); + return ResultWrapper::unwrap( $res )->numFields(); } function fieldName( $stmt, $n ) { @@ -326,7 +306,7 @@ class DatabaseOracle extends Database { if ( $res instanceof ORAResult ) { $res->seek( $row ); } else { - $res->result->seek( $row ); + ResultWrapper::unwrap( $res )->seek( $row ); } } @@ -548,7 +528,7 @@ class DatabaseOracle extends Database { } } - if ( !$this->trxLevel ) { + if ( !$this->trxLevel() ) { oci_commit( $this->conn ); } @@ -942,26 +922,24 @@ class DatabaseOracle extends Database { } protected function doBegin( $fname = __METHOD__ ) { - $this->trxLevel = 1; - $this->doQuery( 'SET CONSTRAINTS ALL DEFERRED' ); + $this->query( 'SET CONSTRAINTS ALL DEFERRED' ); } protected function doCommit( $fname = __METHOD__ ) { - if ( $this->trxLevel ) { + if ( $this->trxLevel() ) { $ret = oci_commit( $this->conn ); if ( !$ret ) { throw new DBUnexpectedError( $this, $this->lastError() ); } - $this->trxLevel = 0; - $this->doQuery( 'SET CONSTRAINTS ALL IMMEDIATE' ); + $this->query( 'SET CONSTRAINTS ALL IMMEDIATE' ); } } protected function doRollback( $fname = __METHOD__ ) { - if ( $this->trxLevel ) { + if ( $this->trxLevel() ) { oci_rollback( $this->conn ); - $this->trxLevel = 0; - $this->doQuery( 'SET CONSTRAINTS ALL IMMEDIATE' ); + $ignoreErrors = true; + $this->query( 'SET CONSTRAINTS ALL IMMEDIATE', $fname, $ignoreErrors ); } } @@ -1338,7 +1316,7 @@ class DatabaseOracle extends Database { } } - if ( !$this->trxLevel ) { + if ( !$this->trxLevel() ) { oci_commit( $this->conn ); }