%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyc

�
�ac@s�dZddlZddlmZdejfd��YZdefd��YZdefd	��YZd
efd��YZ	dS(s`Connection pooling for psycopg2

This module implements thread-safe (and not) connection pools.
i����N(t
extensionst	PoolErrorcBseZRS((t__name__t
__module__(((sD/opt/plesk/python/2.7/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((sD/opt/plesk/python/2.7/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
RtNoneR
RtidRtappend(Rtkeytconn((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR<s
cCs|jd7_|jS(sReturn a new unique key.i(R(R((sD/opt/plesk/python/2.7/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 exhaustedN(R	RRRR
RtpopRRtlenRR(RRR((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyt_getconnKs		cCs0|jrtd��n|dkrZ|jjt|��}|dkrZtd��qZnt|j�|jkr�|r�|js�|j	j
}|tjkr�|j
�q�|tjkr�|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(R	RRRtgetRR RRtinfottransaction_statust_exttTRANSACTION_STATUS_UNKNOWNtclosetTRANSACTION_STATUS_IDLEtrollbackRR
(RRRR'tstatus((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyt_putconn^s&		



cCsn|jrtd��nxF|jt|jj��D](}y|j�Wq5tk
r\q5Xq5Wt|_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(	R	RRtlistR
tvaluesR't	ExceptiontTrue(RR((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyt	_closeall�s	#
N(RRt__doc__RRRRR!RR+R0(((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR#s	
	#tSimpleConnectionPoolcBs)eZdZejZejZejZ	RS(s@A connection pool that can't be shared across different threads.(
RRR1RR!tgetconnR+tputconnR0tcloseall(((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR2�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(RRRRRR7((sD/opt/plesk/python/2.7/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(R9tacquireR!trelease(RR((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR3�s
cCs9|jj�z|j|||�Wd|jj�XdS(sPut away an unused connection.N(R9R:R+R;(RRRR'((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR4�s
cCs0|jj�z|j�Wd|jj�XdS(s6Close all connections (even the one currently in use.)N(R9R:R0R;(R((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR5�s
N(	RRR1RRR3RR4R5(((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyR6�s
	(
R1RRR%tErrorRtobjectRR2R6(((sD/opt/plesk/python/2.7/lib64/python2.7/site-packages/psycopg2/pool.pyt<module>so

Zerion Mini Shell 1.0