ok

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyc

�
�6�Rc@s�dZddlZddlZy ddlmZmZmZWn#ek
rceZe	Ze
ZnXdZejeej
ejBejB�ZddlmZmZmZmZmZmZmZmZmZmZdefd��YZdefd	��YZd
efd��YZdefd
��YZ defd��YZ!de!fd��YZ"dee efd��YZ#dee!efd��YZ$dee efd��YZ%dee!efd��YZ&dS(szMySQLdb Cursors

This module implements Cursors of various types for MySQLdb. By
default, MySQLdb uses the Cursor class.

i����N(tListTypet	TupleTypetUnicodeTypes�
    \s
    values
    \s*
    (
        \(
            [^()']*
            (?:
                (?:
                        (?:\(
                            # ( - editor hightlighting helper
                            .*
                        \))
                    |
                        '
                            [^\\']*
                            (?:\\.[^\\']*)*
                        '
                )
                [^()']*
            )*
        \)
    )
(
tWarningtErrortInterfaceErrort	DataErrort
DatabaseErrortOperationalErrortIntegrityErrort
InternalErrortNotSupportedErrortProgrammingErrort
BaseCursorcBsGeZdZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZeZd�Zd�Zd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zdd�Zd�Zdd�Zd�Z d�Z!dd�Z"d�Z#eZeZeZeZe	Z	e
Z
eZeZe
Z
eZRS(sA base for Cursor classes. Useful attributes:
    
    description
        A tuple of DB API 7-tuples describing the columns in
        the last executed query; see PEP-249 for details.

    description_flags
        Tuple of column flags for last query, one entry per column
        in the result set. Values correspond to those in
        MySQLdb.constants.FLAG. See MySQL documentation (C API)
        for more information. Non-standard extension.
    
    arraysize
        default number of rows fetchmany() will fetch

    i����(t
MySQLErrorRRRRRRR	R
RRcCs�ddlm}||�|_d|_d|_d|_d|_d|_d|_	g|_
|j|_d|_d|_
d|_d|_dS(Ni����(tproxyii(tweakrefRt
connectiontNonetdescriptiontdescription_flagstrowcountt	arraysizet	_executedt	lastrowidtmessagesterrorhandlert_resultt	_warningst_infot	rownumber(tselfRR((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt__init__Ks										cCs |j�d|_d|_dS(N(tcloseRRR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt__del__\s
	cCs-|js
dSx|j�rqWd|_dS(s6Close the cursor. No further queries will be possible.N(RtnextsetR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR!as
	cCs#|js|j|td�ndS(Nsexecute() first(RRR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt_check_executedgs	cCs�ddlm}|jr�|j�j�}|r�x'|D]}|jj|j|f�q8Wxf|D]}||d|jd�qbWq�|jr�|jj|j|jf�||j|jd�q�ndS(Ni����(twarni(	twarningsR%Rt_get_dbt
show_warningsRtappendRR(RR%R&tw((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt_warning_checkks	

	cCsg|jr|j�n|j2|j�}|j�}|dkrEdS|j�|j�|j�dS(s`Advance to the next result set.

        Returns None if there are no more result sets.
        i����iN(	RtfetchallRR'tnext_resultRt_do_get_resultt_post_get_resultR+(Rtdbtnr((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR#zs	



cCsdS(N((R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR/�scCs�|j�}|j�|_|j�|_d|_|jrK|jj�pNd|_|jrl|jj	�pod|_
|j�|_|j
�|_|j�|_dS(Ni(R't_get_resultRt
affected_rowsRRtdescribeRRtfield_flagsRt	insert_idRt
warning_countRtinfoR(RR0((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR.�s	!!cGsdS(s!Does nothing, required by DB API.N((Rtargs((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt
setinputsizes�scGsdS(s!Does nothing, required by DB API.N((RR9((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytsetoutputsizes�scCs&|js|j|td�n|jS(Ns
cursor closed(RRR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR'�s	c	s�|j2|j��t|t�r:|j�jj�}n|dk	r�t|t�r~|t�fd�|j	�D��}q�|t
g|D]}�j|�^q��}nyd}|j|�}Wn�t
k
rQ}|jddkr%|jjt|jdf�|j|t|jd�q�|jjt
|f�|j|t
|�nattfk
rj�nHtj�\}}}~|jj||f�|j|||�nX||_|js�|j�n|S(s�Execute a query.
        
        query -- string, query to execute on server
        args -- optional sequence or mapping, parameters to use with query.

        Note: If args is a sequence, then %s must be used as the
        parameter placeholder in the query. If a mapping is used,
        %(key)s must be used as the placeholder.

        Returns long integer rows affected, if any

        c3s*|] \}}|�j|�fVqdS(N(tliteral(t.0tkeytitem(R0(sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pys	<genexpr>�sis&not enough arguments for format stringsnot all arguments convertedN(s&not enough arguments for format stringsnot all arguments converted(RR't
isinstancetunicodetencodetunicode_literaltcharsetRtdictt	iteritemsttupleR<t_queryt	TypeErrorR9R)RRt
SystemExittKeyboardInterrupttsystexc_infoRt_defer_warningsR+(	RtqueryR9R?trtmtexctvaluettb((R0sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytexecute�s</
			
cs3|j2|j��|sdSt|t�rD|j�jj�}ntj|�}|s�d}x$|D]}||j	||�}qfW|S|j
d�}|jd�}|jd�}y�g}	x�|D]x}t|t
�r|	j|t
�fd�|j�D���q�|	j|tg|D]}
�j|
�^q��q�WWn�tk
r�}|jdd	kr�|j|t|jd�q�|j|t|�nKttfk
r��n2tj�\}}
}~|j|||
�nX|jdj|| dj|	�||g��}|js/|j�n|S(
s�Execute a multi-row query.
        
        query -- string, query to execute on server

        args

            Sequence of sequences or mappings, parameters to use with
            query.
            
        Returns long integer rows affected, if any.
        
        This method improves performance on multiple-row INSERT and
        REPLACE. Otherwise it is equivalent to looping over args with
        execute().

        Niic3s*|] \}}|�j|�fVqdS(N(R<(R=R>R?(R0(sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pys	<genexpr>�ss&not enough arguments for format stringsnot all arguments converteds
s,
(s&not enough arguments for format stringsnot all arguments converted(RR'R@RARBRCRDt
insert_valuestsearchRUtstarttendtgroupRER)RFRGR<RIR9RRRJRKRLRMRHtjoinRNR+(RROR9RQRPtatptetqvtqR?tmsgRRRSRT((R0sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytexecutemany�sJ

;
	2	
cCs|j�}xtt|�D]f\}}d|||j|�f}t|t�rh|j|jj�}n|j|�|j	�qWd|dj
gtt|��D]}d||f^q��f}t
|�tkr�|j|jj�}n|j|�||_|js|j�n|S(s'Execute stored procedure procname with args
        
        procname -- string, name of procedure to execute on server

        args -- Sequence of parameters to use with procedure

        Returns the original args.

        Compatibility warning: PEP-249 specifies that any modified
        parameters must be returned. This is currently impossible
        as they are only available by storing them in a server
        variable and then retrieved by a query. Since stored
        procedures return zero or more result sets, there is no
        reliable way to get at OUT or INOUT parameters via callproc.
        The server variables are named @_procname_n, where procname
        is the parameter above and n is the position of the parameter
        (from zero). Once all result sets generated by the procedure
        have been fetched, you can issue a SELECT @_procname_0, ...
        query using .execute() to get any OUT or INOUT values.

        Compatibility warning: The act of calling a stored procedure
        itself creates an empty result set. This appears after any
        result sets generated by the procedure. This is non-standard
        behavior with respect to the DB-API. Be sure to use nextset()
        to advance through all result sets; otherwise you may get
        disconnected.
        sSET @_%s_%d=%ssCALL %s(%s)t,s@_%s_%d(R't	enumerateR<R@RARBRCRDRHR#R[trangetlenttypeRRRNR+(RtprocnameR9R0tindextargR`ti((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytcallproc
s$	
	3
		
cCs3|j�}||_|j|�|j�|jS(N(R't_last_executedROR.R(RR`R0((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt	_do_query;s
	

cCs
|j|�S(N(Rn(RR`((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRHBsicCs#|js
dS|jj||j�S(N((Rt	fetch_rowt_fetch_type(Rtsize((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt
_fetch_rowDs	cCst|jd�S(N(titertfetchoneR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt__iter__IsN(($t__name__t
__module__t__doc__t_mysql_exceptionsRRRRRRRR	R
RRtFalseRNR R"R!R$R+R#R/R.R:R;R'RRURbRlRnRHRrRu(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR
2s>L											.	81			tCursorStoreResultMixIncBs\eZdZd�Zd�Zd�Zd�Zd
d�Zd�Z	dd�Z
d	�ZRS(sThis is a MixIn class which causes the entire result set to be
    stored on the client side, i.e. it uses mysql_store_result(). If the
    result set can be very large, consider adding a LIMIT clause to your
    query, or using CursorUseResultMixIn instead.cCs|j�j�S(N(R'tstore_result(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR2_scCs|j|�}|j�|S(N(RnR/(RR`R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRHas
cCs|jd�|_d|_dS(Ni(Rrt_rowsRR(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR/fscCsJ|j�|jt|j�kr&dS|j|j}|jd|_|S(s]Fetches a single row from the cursor. None indicates that
        no more rows are available.iN(R$RRfR}R(Rtresult((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRtjs
cCsR|j�|j|p|j}|j|j|!}t|t|j��|_|S(s�Fetch up to size rows from the cursor. Result set may be smaller
        than size. If size is not defined, cursor.arraysize is used.(R$RRR}tminRf(RRqRYR~((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt	fetchmanyss

cCsE|j�|jr&|j|j}n	|j}t|j�|_|S(s*Fetchs all available rows from the cursor.(R$RR}Rf(RR~((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR,|s
		trelativecCs�|j�|dkr&|j|}n2|dkr;|}n|j|tdt|��|dksy|t|j�kr�|j|td�n||_dS(sScroll the cursor in the result set to a new position according
        to mode.
        
        If mode is 'relative' (default), value is taken as offset to
        the current position in the result set, if set to 'absolute',
        value states an absolute target position.R�tabsolutesunknown scroll mode %sisout of rangeN(R$RRRtreprRfR}t
IndexError(RRStmodeRP((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytscroll�s
	!cCs6|j�|jr#|j|jp)|j}t|�S(N(R$RR}Rs(RR~((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRu�s
"N(RvRwRxR2RHR/RtRR�R,R�Ru(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR{Xs							
tCursorUseResultMixIncBsMeZdZeZd�Zd�Zdd�Zd�Z	d�Z
d�ZRS(sThis is a MixIn class which causes the result set to be stored
    in the server and sent row-by-row to client side, i.e. it uses
    mysql_use_result(). You MUST retrieve the entire result set and
    close() the cursor before additional queries can be peformed on
    the connection.cCs|j�j�S(N(R't
use_result(R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR2�scCsE|j�|jd�}|s-|j�dS|jd|_|dS(s%Fetches a single row from the cursor.iiN(R$RrR+RR(RRP((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRt�s

cCsO|j�|j|p|j�}|jt|�|_|sK|j�n|S(s�Fetch up to size rows from the cursor. Result set may be smaller
        than size. If size is not defined, cursor.arraysize is used.(R$RrRRRfR+(RRqRP((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR��s

cCs=|j�|jd�}|jt|�|_|j�|S(s*Fetchs all available rows from the cursor.i(R$RrRRfR+(RRP((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR,�s


cCs|S(N((R((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyRu�scCs%|j�}|dkr!t�n|S(N(RtRt
StopIteration(Rtrow((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytnext�s	N(RvRwRxtTrueRNR2RtRR�R,RuR�(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR��s		

		tCursorTupleRowsMixIncBseZdZdZRS(swThis is a MixIn class that causes all rows to be returned as tuples,
    which is the standard form required by DB API.i(RvRwRxRp(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR��stCursorDictRowsMixIncBs2eZdZdZd�Zdd�Zd�ZRS(snThis is a MixIn class that causes all rows to be returned as
    dictionaries. This is a non-standard feature.icCs*ddlm}|dtd�|j�S(sgFetch a single row as a dictionary. Deprecated:
        Use fetchone() instead. Will be removed in 1.3.i����(R%s9fetchoneDict() is non-standard and will be removed in 1.3i(R&R%tDeprecationWarningRt(RR%((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytfetchoneDict�s
cCs-ddlm}|dtd�|j|�S(srFetch several rows as a list of dictionaries. Deprecated:
        Use fetchmany() instead. Will be removed in 1.3.i����(R%s:fetchmanyDict() is non-standard and will be removed in 1.3i(R&R%R�R�(RRqR%((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt
fetchmanyDict�s
cCs*ddlm}|dtd�|j�S(swFetch all available rows as a list of dictionaries. Deprecated:
        Use fetchall() instead. Will be removed in 1.3.i����(R%s9fetchallDict() is non-standard and will be removed in 1.3i(R&R%R�R,(RR%((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pytfetchallDict�s
N(RvRwRxRpR�RR�R�(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR��s
	tCursorOldDictRowsMixIncBseZdZdZRS(s�This is a MixIn class that returns rows as dictionaries with
    the same key convention as the old Mysqldb (MySQLmodule). Don't
    use this.i(RvRwRxRp(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR��stCursorcBseZdZRS(sjThis is the standard Cursor class that returns rows as tuples
    and stores the result set in the client.(RvRwRx(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR�st
DictCursorcBseZdZRS(seThis is a Cursor class that returns rows as dictionaries and
    stores the result set in the client.(RvRwRx(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR�	stSSCursorcBseZdZRS(s_This is a Cursor class that returns rows as tuples and stores
    the result set in the server.(RvRwRx(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR�stSSDictCursorcBseZdZRS(seThis is a Cursor class that returns rows as dictionaries and
    stores the result set in the server.(RvRwRx(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyR�s('RxtreRLttypesRRRtImportErrortlistRGtstrtrestrtcompiletStItXRVRyRRRRRRR	R
RRtobjectR
R{R�R�R�R�R�R�R�R�(((sB/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/cursors.pyt<module>s4 

#F�'G2 					

Zerion Mini Shell 1.0