http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70558
Revision: 70558
Author: demon
Date: 2010-08-06 12:54:39 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
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
trunk/phase3/includes/db/DatabasePostgres.php
Modified: trunk/phase3/includes/db/Database.php
===================================================================
--- trunk/phase3/includes/db/Database.php 2010-08-06 12:15:23 UTC (rev
70557)
+++ trunk/phase3/includes/db/Database.php 2010-08-06 12:54:39 UTC (rev
70558)
@@ -1982,8 +1982,10 @@
* End a transaction
*/
function commit( $fname = 'Database::commit' ) {
- $this->query( 'COMMIT', $fname );
- $this->mTrxLevel = 0;
+ if( $this->mTrxLevel ) {
+ $this->query( 'COMMIT', $fname );
+ $this->mTrxLevel = 0;
+ }
}
/**
@@ -1991,8 +1993,10 @@
* No-op on non-transactional databases.
*/
function rollback( $fname = 'Database::rollback' ) {
- $this->query( 'ROLLBACK', $fname, true );
- $this->mTrxLevel = 0;
+ if( $this->mTrxLevel ) {
+ $this->query( 'ROLLBACK', $fname, true );
+ $this->mTrxLevel = 0;
+ }
}
/**
Modified: trunk/phase3/includes/db/DatabasePostgres.php
===================================================================
--- trunk/phase3/includes/db/DatabasePostgres.php 2010-08-06 12:15:23 UTC
(rev 70557)
+++ trunk/phase3/includes/db/DatabasePostgres.php 2010-08-06 12:54:39 UTC
(rev 70558)
@@ -1282,16 +1282,6 @@
return pg_field_type( $res, $index );
}
- function begin( $fname = 'DatabasePostgres::begin' ) {
- $this->query( 'BEGIN', $fname );
- $this->mTrxLevel = 1;
- }
-
- function commit( $fname = 'DatabasePostgres::commit' ) {
- $this->query( 'COMMIT', $fname );
- $this->mTrxLevel = 0;
- }
-
/* Not even sure why this is used in the main codebase... */
function limitResultForUpdate( $sql, $num ) {
return $sql;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs