File: //usr/lib/python3/dist-packages/twisted/enterprise/__pycache__/adbapi.cpython-310.pyc
o
�bA � @ sf d Z ddlmZ ddlmZmZ G dd� de�ZG dd� d�ZG dd � d �Z G d
d� d�Z
d dgZdS )
zg
An asynchronous mapping to U{DB-API
2.0<http://www.python.org/topics/database/DatabaseAPI-2.0.html>}.
� )�threads)�log�reflectc @ s e Zd ZdZdS )�ConnectionLostzb
This exception means that a db connection has been lost. Client code may
try again.
N)�__name__�
__module__�__qualname__�__doc__� r
r
�;/usr/lib/python3/dist-packages/twisted/enterprise/adbapi.pyr s r c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�
Connectiona
A wrapper for a DB-API connection instance.
The wrapper passes almost everything to the wrapped connection and so has
the same API. However, the L{Connection} knows about its pool and also
handle reconnecting should when the real connection dies.
c C s || _ d | _| �� d S �N)�_pool�_connection� reconnect)�self�poolr
r
r �__init__ � zConnection.__init__c C s d S r
r
�r r
r
r �close$ s zConnection.closec C s� | j js| j�� d S z| j�� | j�� }|�| j j� |�� | j�� W d S t y7 t
�d d� Y nw | j �| j� | j j
rHt
�d� t� �)N�Rollback failedzConnection lost.)r r r �rollback�cursor�execute�good_sqlr �commit�
BaseExceptionr �err�
disconnect�noisy�msgr )r �cursr
r
r r . s"