* 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;
+ }
}
/**
* 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;
+ }
}
/**
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;