r86702 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86701‎ | r86702 | r86703 >
Date:11:32, 22 April 2011
Author:freakolowsky
Status:resolved
Tags:
Comment:
* merge of r86701
Modified paths:
  • /branches/REL1_17/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/oracle/tables.sql (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/maintenance/oracle/tables.sql
@@ -72,6 +72,10 @@
7373 CREATE INDEX &mw_prefix.page_i01 ON &mw_prefix.page (page_random);
7474 CREATE INDEX &mw_prefix.page_i02 ON &mw_prefix.page (page_len);
7575
 76+-- Create a dummy page to satisfy fk contraints especially with revisions
 77+INSERT INTO &mw_prefix.page
 78+ VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, 0, 0);
 79+
7680 /*$mw$*/
7781 CREATE TRIGGER &mw_prefix.page_set_random BEFORE INSERT ON &mw_prefix.page
7882 FOR EACH ROW WHEN (new.page_random IS NULL)
Index: branches/REL1_17/phase3/includes/db/DatabaseOracle.php
@@ -224,7 +224,6 @@
225225 throw new DBConnectionError( $this, "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n (Note: if you recently installed PHP, you may need to restart your webserver and database)\n" );
226226 }
227227
228 - $this->close();
229228 $this->mUser = $user;
230229 $this->mPassword = $password;
231230 // changed internal variables functions
@@ -278,6 +277,9 @@
279278 function close() {
280279 $this->mOpened = false;
281280 if ( $this->mConn ) {
 281+ if ( $this->mTrxLevel ) {
 282+ $this->commit();
 283+ }
282284 return oci_close( $this->mConn );
283285 } else {
284286 return true;
@@ -562,7 +564,7 @@
563565
564566 wfSuppressWarnings();
565567
566 - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) {
 568+ if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
567569 $e = oci_error( $stmt );
568570 if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
569571 $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
@@ -964,7 +966,7 @@
965967 }
966968
967969 $fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name '.$tableWhere.' and column_name = \''.$field.'\'' );
968 - if ( oci_execute( $fieldInfoStmt, OCI_DEFAULT ) === false ) {
 970+ if ( oci_execute( $fieldInfoStmt, $this->execFlags() ) === false ) {
969971 $e = oci_error( $fieldInfoStmt );
970972 $this->reportQueryError( $e['message'], $e['code'], 'fieldInfo QUERY', __METHOD__ );
971973 return false;
@@ -995,15 +997,24 @@
996998 return $this->fieldInfoMulti ($table, $field);
997999 }
9981000
999 - function begin( $fname = '' ) {
 1001+ function begin( $fname = 'DatabaseOracle::begin' ) {
10001002 $this->mTrxLevel = 1;
10011003 }
10021004
1003 - function commit( $fname = '' ) {
1004 - oci_commit( $this->mConn );
1005 - $this->mTrxLevel = 0;
 1005+ function commit( $fname = 'DatabaseOracle::commit' ) {
 1006+ if ( $this->mTrxLevel ) {
 1007+ oci_commit( $this->mConn );
 1008+ $this->mTrxLevel = 0;
 1009+ }
10061010 }
10071011
 1012+ function rollback( $fname = 'DatabaseOracle::rollback' ) {
 1013+ if ( $this->mTrxLevel ) {
 1014+ oci_rollback( $this->mConn );
 1015+ $this->mTrxLevel = 0;
 1016+ }
 1017+ }
 1018+
10081019 /* Not even sure why this is used in the main codebase... */
10091020 function limitResultForUpdate( $sql, $num ) {
10101021 return $sql;
@@ -1284,7 +1295,7 @@
12851296
12861297 wfSuppressWarnings();
12871298
1288 - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) {
 1299+ if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
12891300 $e = oci_error( $stmt );
12901301 if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
12911302 $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86701* begin, commit, rollback functions updated...freakolowsky11:31, 22 April 2011

Status & tagging log