File: //opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/base.cpython-37.pyc
B
��4]�H � @ s d dl mZ d dlZd dlZddlmZ ddlmZ ddlmZ ddl m
Z
dd l mZ dd
l mZ ddl mZ ddlm
Z
ddlmZ G d
d� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� deej�ZG dd� de�ZdS )� )�with_statementN� )�Connectable)�ExceptionContext)�_distill_params� )�exc)�
interfaces)�log)�util)�schemac @ s e Zd ZdZe�d�Zdtdd�Zdd� Ze dd � �Z
d
d� Zdd
� Zdd� Z
dd� Zdd� Ze dd� �Ze dd� �Ze dd� �Zdd� Ze dd� �Zdd� Ze d d!� �Ze d"d#� �Ze d$d%� �Zd&d'� Zd(d)� Zdud*d+�Zd,d-� Zd.d/� Zd0d1� Zdvd2d3�Zd4d5� Z dwd6d7�Z!dxd8d9�Z"d:d;� Z#d<d=� Z$d>d?� Z%dyd@dA�Z&dzdBdC�Z'dDdE� Z(dFdG� Z)dHdI� Z*dJdK� Z+dLdM� Z,dNdO� Z-dPdQ� Z.dRdS� Z/dTdU� Z0dVdW� Z1dXdY� Z2dZd[� Z3d\d]� Z4d^d_� Z5d`da� Z6dbdc� Z7ddde� Z8d{dfdg�Z9dhdi� Z:dZ;dZ<djdk� Z=e>dldm� �Z?dndo� Z@dpdq� ZAdrds� ZBdS )|�
Connectiona: Provides high-level functionality for a wrapped DB-API connection.
Provides execution support for string-based SQL statements as well as
:class:`.ClauseElement`, :class:`.Compiled` and :class:`.DefaultGenerator`
objects. Provides a :meth:`begin` method to return :class:`.Transaction`
objects.
The Connection object is **not** thread-safe. While a Connection can be
shared among threads using properly synchronized access, it is still
possible that the underlying DBAPI connection may not support shared
access between threads. Check the DBAPI documentation for details.
The Connection object represents a single dbapi connection checked out
from the connection pool. In this state, the connection pool has no affect
upon the connection, including its expiration or timeout state. For the
connection pool to properly manage connections, connections should be
returned to the connection pool (i.e. ``connection.close()``) whenever the
connection is not in use.
.. index::
single: thread safety; Connection
NFc C s� || _ |j| _|| _|dk | _|rT|| _|| _|j| _d| _|| _|j | _ |j
| _
n||dk r`|n|�� | _d| _d| _
|| _d| _d| _| j �� | _|dkr�| j�|j�| _|p�|dko�|j | _ |r�t�|j| _| j s�| j j r�| j�| | j� dS )z�Construct a new Connection.
The constructor here is not public and is only called only by an
:class:`.Engine`. See :meth:`.Engine.connect` and
:meth:`.Engine.contextual_connect` methods.
NFr T)�engine�dialect�_Connection__branch_fromZ_Connection__branch�_Connection__connection�_execution_options�_echo�should_close_with_result�dispatch�_has_events�schema_for_object�raw_connection�_Connection__transaction�_Connection__savepoint_seq�_Connection__invalid�_Connection__can_reconnectZ_should_log_info�_join�AssertionErrorZengine_connect)�selfr �
connection�close_with_result�_branch_fromr � _dispatchr � r$ �I/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/base.py�__init__E s8
zConnection.__init__c C s6 | j r| j �� S | jj| j| j| | j| j| jd�S dS )a� Return a new Connection which references this Connection's
engine and connection; but does not have close_with_result enabled,
and also whose close() method does nothing.
The Core uses this very sparingly, only in the case of
custom SQL default functions that are to be INSERTed as the
primary key of a row where we need to get the value back, so we have
to invoke it distinctly - this is a very uncommon case.
Userland code accesses _branch() when the connect() or
contextual_connect() methods are called. The branched connection
acts as much as possible like the parent, except that it stays
connected when a close() event occurs.
)r"