#NEWLINE# @ require_open_connection #NEWLINE# def tpc_rollback( self , xid = None ) : #NEWLINE# #INDENT# 'Commit a prepared two-phase transaction' #NEWLINE# try : #NEWLINE# #INDENT# previous_autocommit_mode = self . autocommit #NEWLINE# if ( not xid ) : #NEWLINE# #INDENT# tpc_xid = tpc_xid . __tpc_xid #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tpc_xid = xid #NEWLINE# if ( not ( xid in self . tpc_recover ( ) ) ) : #NEWLINE# #INDENT# raise ProgrammingError ( 'Requested TPC transaction is not prepared!' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not tpc_xid ) : #NEWLINE# #INDENT# raise ProgrammingError ( 'Cannot tpc_rollback() without a TPC prepared transaction!' ) #NEWLINE# #UNINDENT# if ( self . __tpc_prepared or ( ( xid != self . __tpc_xid ) and xid ) ) : #NEWLINE# #INDENT# self . autocommit = True #NEWLINE# try : #NEWLINE# #INDENT# self . conn . execute ( ( "ROLLBACK PREPARED '%s';" % ( tpc_xid [ 1 ] , ) ) , simple_query = True ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . autocommit = previous_autocommit_mode #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . conn . rollback ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . autocommit = previous_autocommit_mode #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# self . __tpc_xid = None