Index: trunk/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: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -275,6 +275,9 @@ |
276 | 276 | function close() { |
277 | 277 | $this->mOpened = false; |
278 | 278 | if ( $this->mConn ) { |
| 279 | + if ( $this->mTrxLevel ) { |
| 280 | + $this->commit(); |
| 281 | + } |
279 | 282 | return oci_close( $this->mConn ); |
280 | 283 | } else { |
281 | 284 | return true; |
— | — | @@ -559,7 +562,7 @@ |
560 | 563 | |
561 | 564 | wfSuppressWarnings(); |
562 | 565 | |
563 | | - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) { |
| 566 | + if ( oci_execute( $stmt, $this->execFlags() ) === false ) { |
564 | 567 | $e = oci_error( $stmt ); |
565 | 568 | if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) { |
566 | 569 | $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); |
— | — | @@ -921,7 +924,7 @@ |
922 | 925 | } |
923 | 926 | |
924 | 927 | $fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name '.$tableWhere.' and column_name = \''.$field.'\'' ); |
925 | | - if ( oci_execute( $fieldInfoStmt, OCI_DEFAULT ) === false ) { |
| 928 | + if ( oci_execute( $fieldInfoStmt, $this->execFlags() ) === false ) { |
926 | 929 | $e = oci_error( $fieldInfoStmt ); |
927 | 930 | $this->reportQueryError( $e['message'], $e['code'], 'fieldInfo QUERY', __METHOD__ ); |
928 | 931 | return false; |
— | — | @@ -958,15 +961,24 @@ |
959 | 962 | return $this->fieldInfoMulti ($table, $field); |
960 | 963 | } |
961 | 964 | |
962 | | - function begin( $fname = '' ) { |
| 965 | + function begin( $fname = 'DatabaseOracle::begin' ) { |
963 | 966 | $this->mTrxLevel = 1; |
964 | 967 | } |
965 | 968 | |
966 | | - function commit( $fname = '' ) { |
967 | | - oci_commit( $this->mConn ); |
968 | | - $this->mTrxLevel = 0; |
| 969 | + function commit( $fname = 'DatabaseOracle::commit' ) { |
| 970 | + if ( $this->mTrxLevel ) { |
| 971 | + oci_commit( $this->mConn ); |
| 972 | + $this->mTrxLevel = 0; |
| 973 | + } |
969 | 974 | } |
970 | 975 | |
| 976 | + function rollback( $fname = 'DatabaseOracle::rollback' ) { |
| 977 | + if ( $this->mTrxLevel ) { |
| 978 | + oci_rollback( $this->mConn ); |
| 979 | + $this->mTrxLevel = 0; |
| 980 | + } |
| 981 | + } |
| 982 | + |
971 | 983 | /* Not even sure why this is used in the main codebase... */ |
972 | 984 | function limitResultForUpdate( $sql, $num ) { |
973 | 985 | return $sql; |
— | — | @@ -1085,7 +1097,7 @@ |
1086 | 1098 | } |
1087 | 1099 | |
1088 | 1100 | public function removeIdentifierQuotes( $s ) { |
1089 | | - return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); |
| 1101 | + return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); ; |
1090 | 1102 | } |
1091 | 1103 | |
1092 | 1104 | public function isQuotedIdentifier( $s ) { |
— | — | @@ -1255,7 +1267,7 @@ |
1256 | 1268 | |
1257 | 1269 | wfSuppressWarnings(); |
1258 | 1270 | |
1259 | | - if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) { |
| 1271 | + if ( oci_execute( $stmt, $this->execFlags() ) === false ) { |
1260 | 1272 | $e = oci_error( $stmt ); |
1261 | 1273 | if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) { |
1262 | 1274 | $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); |