function close() {
$this->mOpened = false;
if ( $this->mConn ) {
+ if ( $this->mTrxLevel ) {
+ $this->commit();
+ }
return oci_close( $this->mConn );
} else {
return true;
wfSuppressWarnings();
- if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) {
+ if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
}
$fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name '.$tableWhere.' and column_name = \''.$field.'\'' );
- if ( oci_execute( $fieldInfoStmt, OCI_DEFAULT ) === false ) {
+ if ( oci_execute( $fieldInfoStmt, $this->execFlags() ) === false ) {
$e = oci_error( $fieldInfoStmt );
$this->reportQueryError( $e['message'], $e['code'], 'fieldInfo QUERY', __METHOD__ );
return false;
return $this->fieldInfoMulti ($table, $field);
}
- function begin( $fname = '' ) {
+ function begin( $fname = 'DatabaseOracle::begin' ) {
$this->mTrxLevel = 1;
}
- function commit( $fname = '' ) {
- oci_commit( $this->mConn );
- $this->mTrxLevel = 0;
+ function commit( $fname = 'DatabaseOracle::commit' ) {
+ if ( $this->mTrxLevel ) {
+ oci_commit( $this->mConn );
+ $this->mTrxLevel = 0;
+ }
+ }
+
+ function rollback( $fname = 'DatabaseOracle::rollback' ) {
+ if ( $this->mTrxLevel ) {
+ oci_rollback( $this->mConn );
+ $this->mTrxLevel = 0;
+ }
}
/* Not even sure why this is used in the main codebase... */
}
public function removeIdentifierQuotes( $s ) {
- return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5);
+ return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); ;
}
public function isQuotedIdentifier( $s ) {
wfSuppressWarnings();
- if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) {
+ if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
CREATE INDEX &mw_prefix.page_i01 ON &mw_prefix.page (page_random);
CREATE INDEX &mw_prefix.page_i02 ON &mw_prefix.page (page_len);
+-- Create a dummy page to satisfy fk contraints especially with revisions
+INSERT INTO &mw_prefix.page
+ VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, 0, 0);
+
/*$mw$*/
CREATE TRIGGER &mw_prefix.page_set_random BEFORE INSERT ON &mw_prefix.page
FOR EACH ROW WHEN (new.page_random IS NULL)