Reset the connection state. Calling this will reset the connection session state to a state resembling that of a newly obtained connection. Namely, an open transaction (if any) is rolled back, open cursors are closed, all `LISTEN <https://www.postgresql.org/docs/cur
(self, *, timeout=None)
| 1565 | await self.execute("ROLLBACK") |
| 1566 | |
| 1567 | async def reset(self, *, timeout=None): |
| 1568 | """Reset the connection state. |
| 1569 | |
| 1570 | Calling this will reset the connection session state to a state |
| 1571 | resembling that of a newly obtained connection. Namely, an open |
| 1572 | transaction (if any) is rolled back, open cursors are closed, |
| 1573 | all `LISTEN <https://www.postgresql.org/docs/current/sql-listen.html>`_ |
| 1574 | registrations are removed, all session configuration |
| 1575 | variables are reset to their default values, and all advisory locks |
| 1576 | are released. |
| 1577 | |
| 1578 | Note that the above describes the default query returned by |
| 1579 | :meth:`Connection.get_reset_query`. If one overloads the method |
| 1580 | by subclassing ``Connection``, then this method will do whatever |
| 1581 | the overloaded method returns, except open transactions are always |
| 1582 | terminated and any callbacks registered by |
| 1583 | :meth:`Connection.add_listener` or :meth:`Connection.add_log_listener` |
| 1584 | are removed. |
| 1585 | |
| 1586 | :param float timeout: |
| 1587 | A timeout for resetting the connection. If not specified, defaults |
| 1588 | to no timeout. |
| 1589 | """ |
| 1590 | async with compat.timeout(timeout): |
| 1591 | await self._reset() |
| 1592 | reset_query = self.get_reset_query() |
| 1593 | if reset_query: |
| 1594 | await self.execute(reset_query) |
| 1595 | |
| 1596 | def _abort(self): |
| 1597 | # Put the connection into the aborted state. |
no test coverage detected