MCPcopy
hub / github.com/MagicStack/asyncpg / __rollback

Method __rollback

asyncpg/transaction.py:194–211  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

192 self._state = TransactionState.COMMITTED
193
194 async def __rollback(self):
195 self.__check_state('rollback')
196
197 if self._connection._top_xact is self:
198 self._connection._top_xact = None
199
200 if self._nested:
201 query = 'ROLLBACK TO {};'.format(self._id)
202 else:
203 query = 'ROLLBACK;'
204
205 try:
206 await self._connection.execute(query)
207 except BaseException:
208 self._state = TransactionState.FAILED
209 raise
210 else:
211 self._state = TransactionState.ROLLEDBACK
212
213 @connresource.guarded
214 async def commit(self):

Callers 2

__aexit__Method · 0.95
rollbackMethod · 0.95

Calls 2

__check_stateMethod · 0.95
executeMethod · 0.45

Tested by

no test coverage detected