%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/enterprise/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/enterprise/__pycache__/adbapi.cpython-312.pyc |
� Ϫ�fA � �~ � d Z ddlmZ ddlmZmZ G d� de� Z G d� d� Z G d� d � Z G d � d� Z d dgZy) zg An asynchronous mapping to U{DB-API 2.0<http://www.python.org/topics/database/DatabaseAPI-2.0.html>}. � )�threads)�log�reflectc � � e Zd ZdZy)�ConnectionLostzb This exception means that a db connection has been lost. Client code may try again. N)�__name__� __module__�__qualname__�__doc__� � �;/usr/lib/python3/dist-packages/twisted/enterprise/adbapi.pyr r s � �r r c �. � e Zd ZdZd� Zd� Zd� Zd� Zd� Zy)� 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 �@ � || _ d | _ | j � y �N)�_pool�_connection� reconnect)�self�pools r �__init__zConnection.__init__ s � ��� �������r c � � y r r �r s r �closezConnection.close$ s � � r c �l � | j j s| j j � y | j j � | j j � }|j | j j � |j � | j j � y # t $ r t j d d� Y nw xY w| j j | j � | j j rt j d� t � �)N�Rollback failedzConnection lost.)r r r �rollback�cursor�execute�good_sqlr �commit� BaseExceptionr �err� disconnect�noisy�msgr )r �curss r r zConnection.rollback. s� � ��z�z�#�#����%�%�'�� -����%�%�'��#�#�*�*�,�D��L�L����,�,�-��J�J�L����#�#�%���� -��G�G�D�+�,� -�� � � ���d�.�.�/��:�:����G�G�&�'���s �BB7 �7C�Cc � � | j �%| j j | j � | j j � | _ y r )r r r% �connectr s r r zConnection.reconnectD s; � ����'��J�J�!�!�$�"2�"2�3��:�:�-�-�/��r c �. � t | j |� S r )�getattrr �r �names r �__getattr__zConnection.__getattr__I s � ��t�'�'��.�.r N) r r r r r r r r r/ r r r r r s � ��� ��,0� /r r c �2 � e Zd ZdZdZd� Zd� Zd� Zd� Zd� Z y)�Transactiona A lightweight wrapper for a DB-API 'cursor' object. Relays attribute access to the DB cursor. That is, you can call C{execute()}, C{fetchall()}, etc., and they will be called on the underlying DB-API cursor object. Attributes will also be retrieved from there. Nc �@ � || _ || _ | j � y r )r r �reopen)r r � connections r r zTransaction.__init__Y s � ��� �%������ r c �J � | j }d | _ |j � y r )�_cursorr )r r6 s r r zTransaction.close^ s � ��,�,������ � �r c � � | j �| j � | j j � | _ y # t $ r0 | j j s� t j d d� Y nw xY w| j j rt j d� | j � | j j � | _ y )NzCursor creation failedzConnection lost, reconnecting)r6 r r r r# r r r r$ r&