σ ΓΜ4]c@szdZddlmZddlmZddlmZiZejddƒd„ƒZd „Z d e fd „ƒYZ d S( s€DBAPI proxy utility. Provides transparent connection pooling on top of a Python DBAPI. This is legacy SQLAlchemy functionality that is not typically used today. i(t QueuePooli(tutil(t threadings1.3sYThe :func:`.pool.manage` function is deprecated, and will be removed in a future release.cKs:y t|SWn'tk r5tj|t||ƒSXdS(sHReturn a proxy for a DB-API module that automatically pools connections. Given a DB-API 2.0 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connection arguments sent to the decorated module's connect() function. :param module: a DB-API 2.0 database module :param poolclass: the class used by the pool module to provide pooling. Defaults to :class:`.QueuePool`. :param \**params: will be passed through to *poolclass* N(tproxiestKeyErrort setdefaultt_DBProxy(tmoduletparams((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pytmanages  cCs/xtjƒD]}|jƒq WtjƒdS(sYRemove all current DB-API 2.0 managers. All pools and connections are disposed. N(Rtvaluestclosetclear(tmanager((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pytclear_managers5sRcBsYeZdZed„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z RS( s Layers connection pooling behavior on top of a standard DB-API module. Proxies a DB-API 2.0 connect() call to a connection pool keyed to the specific connect parameters. Other functions and attributes are delegated to the underlying DB-API module. cKs7||_||_||_i|_tjƒ|_dS(sΨInitializes a new proxy. module a DB-API 2.0 module poolclass a Pool class, defaulting to QueuePool Other parameters are sent to the Pool object's constructor. N(Rtkwt poolclasstpoolsRtLockt_create_pool_mutex(tselfRRR((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt__init__Is    cCs(x!t|jƒD]}|j|=qWdS(N(tlistR(Rtkey((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyR \scCs|jƒdS(N(R (R((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt__del__`scCst|j|ƒS(N(tgetattrR(RR((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt __getattr__cscsΊˆjˆˆŽ}yˆj|SWn’tk r΅ˆjjƒzc|ˆjkr•ˆjddƒˆj‡‡‡fd†ˆj}|ˆj|<|Sˆj|SWdˆjj ƒXnXdS(Nt sa_pool_keycsˆjjˆˆŽS(N(Rtconnect((targsRR(sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pytpt( t _serializeRRRtacquiretpoptNoneRRtrelease(RRRRtpool((RRRsN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pytget_poolfs   cOs|j||ŽjƒS(s,Activate a connection to the database. Connect to the database using this DBProxy's module and the given connect arguments. If the arguments match an existing pool, the connection will be returned from the pool's current thread-local connection instance, or if there is no thread-local connection instance it will be checked out from the set of pooled connections. If the pool has no available connections and allows new connections to be created, a new database connection will be made. (R&R(RRR((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyRyscOs8|j||Ž}y|j|=Wntk r3nXdS(s;Dispose the pool referenced by the given connect arguments.N(R RR(RRRR((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pytdispose‰s  cOsKd|kr|dStt|ƒgt|ƒD]}|||f^q-ƒS(NR(ttupleRtsorted(RRRtk((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyR ’s ( t__name__t __module__t__doc__RRR RRR&RR'R (((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyR@s       N( R-timplRRRRRt deprecatedR RtobjectR(((sN/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyts