r70558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70557‎ | r70558 | r70559 >
Date:12:54, 6 August 2010
Author:demon
Status:ok
Tags:
Comment:
Remove dupe implementations of begin/commit from Postgres. Also included checks for $mTrxLevel on commit/rollback, based on patch on bug 24629
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -1282,16 +1282,6 @@
12831283 return pg_field_type( $res, $index );
12841284 }
12851285
1286 - function begin( $fname = 'DatabasePostgres::begin' ) {
1287 - $this->query( 'BEGIN', $fname );
1288 - $this->mTrxLevel = 1;
1289 - }
1290 -
1291 - function commit( $fname = 'DatabasePostgres::commit' ) {
1292 - $this->query( 'COMMIT', $fname );
1293 - $this->mTrxLevel = 0;
1294 - }
1295 -
12961286 /* Not even sure why this is used in the main codebase... */
12971287 function limitResultForUpdate( $sql, $num ) {
12981288 return $sql;
Index: trunk/phase3/includes/db/Database.php
@@ -1982,8 +1982,10 @@
19831983 * End a transaction
19841984 */
19851985 function commit( $fname = 'Database::commit' ) {
1986 - $this->query( 'COMMIT', $fname );
1987 - $this->mTrxLevel = 0;
 1986+ if( $this->mTrxLevel ) {
 1987+ $this->query( 'COMMIT', $fname );
 1988+ $this->mTrxLevel = 0;
 1989+ }
19881990 }
19891991
19901992 /**
@@ -1991,8 +1993,10 @@
19921994 * No-op on non-transactional databases.
19931995 */
19941996 function rollback( $fname = 'Database::rollback' ) {
1995 - $this->query( 'ROLLBACK', $fname, true );
1996 - $this->mTrxLevel = 0;
 1997+ if( $this->mTrxLevel ) {
 1998+ $this->query( 'ROLLBACK', $fname, true );
 1999+ $this->mTrxLevel = 0;
 2000+ }
19972001 }
19982002
19992003 /**

Status & tagging log