Index: branches/REL1_17/phase3/maintenance/oracle/tables.sql |
— | — | @@ -72,6 +72,10 @@ |
73 | 73 | CREATE INDEX &mw_prefix.page_i01 ON &mw_prefix.page (page_random); |
74 | 74 | CREATE INDEX &mw_prefix.page_i02 ON &mw_prefix.page (page_len); |
75 | 75 | |
| 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 | + |
76 | 80 | /*$mw$*/ |
77 | 81 | CREATE TRIGGER &mw_prefix.page_set_random BEFORE INSERT ON &mw_prefix.page |
78 | 82 | FOR EACH ROW WHEN (new.page_random IS NULL) |
Index: branches/REL1_17/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -224,7 +224,6 @@ |
225 | 225 | 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" ); |
226 | 226 | } |
227 | 227 | |
228 | | - $this->close(); |
229 | 228 | $this->mUser = $user; |
230 | 229 | $this->mPassword = $password; |
231 | 230 | // changed internal variables functions |
— | — | @@ -278,6 +277,9 @@ |
279 | 278 | function close() { |
280 | 279 | $this->mOpened = false; |
281 | 280 | if ( $this->mConn ) { |
| 281 | + if ( $this->mTrxLevel ) { |
| 282 | + $this->commit(); |
| 283 | + } |
282 | 284 | return oci_close( $this->mConn ); |
283 | 285 | } else { |
284 | 286 | return true; |
— | — | @@ -562,7 +564,7 @@ |
563 | 565 | |
564 | 566 | wfSuppressWarnings(); |
565 | 567 | |
566 | | - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) { |
| 568 | + if ( oci_execute( $stmt, $this->execFlags() ) === false ) { |
567 | 569 | $e = oci_error( $stmt ); |
568 | 570 | if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) { |
569 | 571 | $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); |
— | — | @@ -964,7 +966,7 @@ |
965 | 967 | } |
966 | 968 | |
967 | 969 | $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 ) { |
969 | 971 | $e = oci_error( $fieldInfoStmt ); |
970 | 972 | $this->reportQueryError( $e['message'], $e['code'], 'fieldInfo QUERY', __METHOD__ ); |
971 | 973 | return false; |
— | — | @@ -995,15 +997,24 @@ |
996 | 998 | return $this->fieldInfoMulti ($table, $field); |
997 | 999 | } |
998 | 1000 | |
999 | | - function begin( $fname = '' ) { |
| 1001 | + function begin( $fname = 'DatabaseOracle::begin' ) { |
1000 | 1002 | $this->mTrxLevel = 1; |
1001 | 1003 | } |
1002 | 1004 | |
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 | + } |
1006 | 1010 | } |
1007 | 1011 | |
| 1012 | + function rollback( $fname = 'DatabaseOracle::rollback' ) { |
| 1013 | + if ( $this->mTrxLevel ) { |
| 1014 | + oci_rollback( $this->mConn ); |
| 1015 | + $this->mTrxLevel = 0; |
| 1016 | + } |
| 1017 | + } |
| 1018 | + |
1008 | 1019 | /* Not even sure why this is used in the main codebase... */ |
1009 | 1020 | function limitResultForUpdate( $sql, $num ) { |
1010 | 1021 | return $sql; |
— | — | @@ -1284,7 +1295,7 @@ |
1285 | 1296 | |
1286 | 1297 | wfSuppressWarnings(); |
1287 | 1298 | |
1288 | | - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) { |
| 1299 | + if ( oci_execute( $stmt, $this->execFlags() ) === false ) { |
1289 | 1300 | $e = oci_error( $stmt ); |
1290 | 1301 | if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) { |
1291 | 1302 | $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); |