403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.27.146
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/__pycache__/result.cpython-37.pyc
B

��4]���@s`dZddlZddlZddlmZddlmZddlmZddlmZddlmZ	yddl
mZd	d
�ZWne
k
r�dd
�ZYnXyddl
mZd
ZWn(e
k
r�dZGdd�de�ZYnXGdd�de�Zyejj�e�Wne
k
r�YnXGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)zSDefine result set constructs including :class:`.ResultProxy`
and :class:`.RowProxy.�N�)�exc)�util)�
expression)�sqltypes)�safe_rowproxy_reconstructorcCs
t||�S)N)r)�cls�state�r
�K/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/engine/result.py�rowproxy_reconstructor!srcCs|�|�}|�|�|S)N)�__new__�__setstate__)rr	�objr
r
rr's

)�BaseRowProxyTFc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)r)�_parent�_row�_processors�_keymapcCs||_||_||_||_dS)z8RowProxy objects are constructed by ResultProxy objects.N)rrrr)�self�parent�row�
processors�keymapr
r
r�__init__7szBaseRowProxy.__init__cCst|j|��ffS)N)r�	__class__�__getstate__)rr
r
r�
__reduce__?szBaseRowProxy.__reduce__cCst|�S)z9Return the values represented by this RowProxy as a list.)�list)rr
r
r�valuesEszBaseRowProxy.valuesccs:x4t|j|j�D]"\}}|dkr(|Vq||�VqWdS)N)�ziprr)r�	processor�valuer
r
r�__iter__IszBaseRowProxy.__iter__cCs
t|j�S)N)�lenr)rr
r
r�__len__PszBaseRowProxy.__len__cCs�y|j|\}}}Wn�tk
r:|j�|�\}}}Ynrtk
r�t|t�r�g}xDt|j||j	|�D]*\}}|dkr�|�
|�qn|�
||��qnWt|�S�YnX|dkr�t�
d|��|dk	r�||j	|�S|j	|SdS)Nz<Ambiguous column name '%s' in result set column descriptions)r�KeyErrorr�
_key_fallback�	TypeError�
isinstance�slicer rr�append�tupler�InvalidRequestError)r�keyr!r�index�lr"r
r
r�__getitem__Ss*
zBaseRowProxy.__getitem__c
Cs>y||Stk
r8}zt|jd��Wdd}~XYnXdS)Nr)r&�AttributeError�args)r�name�er
r
r�__getattr__oszBaseRowProxy.__getattr__N)�__name__�
__module__�__qualname__�	__slots__rrrr#r%r1r6r
r
r
rr4src@s�eZdZdZdZdd�Zdd�Zdd�Zd	Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd	S)$�RowProxyaxProxy values from a single cursor row.

    Mostly follows "ordered dictionary" behavior, mapping result
    values to the string-based column name, the integer position of
    the result in the row, as well as Column instances which can be
    mapped to the original Columns that produced this result set (for
    results that correspond to constructed SQL expressions).
    r
cCs|j�|�S)N)r�_has_key)rr.r
r
r�__contains__�szRowProxy.__contains__cCs|jt|�d�S)N)rr)rr,)rr
r
rr�szRowProxy.__getstate__cCs,|d|_}|d|_|j|_|j|_dS)Nrr)rrrr)rr	rr
r
rr�s
zRowProxy.__setstate__NcCs*t|t�r|t|�t|��S|t|�|�S)N)r)r;r,)r�other�opr
r
r�_op�szRowProxy._opcCs|�|tj�S)N)r@�operator�lt)rr>r
r
r�__lt__�szRowProxy.__lt__cCs|�|tj�S)N)r@rA�le)rr>r
r
r�__le__�szRowProxy.__le__cCs|�|tj�S)N)r@rA�ge)rr>r
r
r�__ge__�szRowProxy.__ge__cCs|�|tj�S)N)r@rA�gt)rr>r
r
r�__gt__�szRowProxy.__gt__cCs|�|tj�S)N)r@rA�eq)rr>r
r
r�__eq__�szRowProxy.__eq__cCs|�|tj�S)N)r@rA�ne)rr>r
r
r�__ne__�szRowProxy.__ne__cCstt�|��S)N)�repr�sql_util�	_repr_row)rr
r
r�__repr__�szRowProxy.__repr__cCs|j�|�S)z4Return True if this RowProxy contains the given key.)rr<)rr.r
r
r�has_key�szRowProxy.has_keycs�fdd����D�S)z@Return a list of tuples, each tuple containing a key/value pair.csg|]}|�|f�qSr
r
)�.0r.)rr
r�
<listcomp>�sz"RowProxy.items.<locals>.<listcomp>)�keys)rr
)rr�items�szRowProxy.itemscCs|jjS)z@Return the list of keys as strings represented by this RowProxy.)rrU)rr
r
rrU�sz
RowProxy.keyscCst|jj�S)N)�iterrrU)rr
r
r�iterkeys�szRowProxy.iterkeyscCst|�S)N)rW)rr
r
r�
itervalues�szRowProxy.itervalues)r7r8r9�__doc__r:r=rr�__hash__r@rCrErGrIrKrMrQrRrVrUrXrYr
r
r
rr;vs&r;c@s~eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
eddd��Zddd�Z
dd�Zddd�Zdd�Zdd�ZdS) �ResultMetaDatazRHandle cursor.description, applying additional info from an execution
    context.)r�case_sensitive�matched_on_namerrU�_orig_processorsc
s�|j}|j}|j�_d�_d�_|jr<|j\}}}t|�}nd}}}}��||||||�}	i�_t	s�t|	���j�
dd�|	D��fdd�|	D��dd�|	D��_tdd�|	D���|�rrt��|k�r\t
�}
xJ|	D]B}|d}||
k�r�j�s|��n|}d|df�|<|
�|�q�W�j�
�fdd�|	D���j�sr�j�
d	d�|	D��n�j�
d
d�|	D���j�
��|�s�|j�r��j�
�fdd�|	D��dS)NFcSs*g|]"}|d|d|d|dff�qS)r��r
)rS�elemr
r
rrT�sz+ResultMetaData.__init__.<locals>.<listcomp>cs.g|]&}|d�|d|d|dff�qS)rr`rar
)rSrb)�len_rawr
rrTscSsg|]}|d�qS)r`r
)rSrbr
r
rrTscSs*g|]"}|d|d|d|dff�qS)rr`rarr
)rSrbr
r
rrT
s�cs2g|]*}|dr|dD]}|�|df�qqS)rarr
)rSrb�obj_elem)�by_keyr
rrT%scSs6g|].}|dr|dd|d|d|dff�qS)rarr`r
)rSrbr
r
rrT3scSs<g|]4}|dr|dD]}||d|d|dff�qqS)rar`rr
)rSrbrer
r
rrT=scs*g|]"}|dr|d�j|df�qS)�r)r)rSrb)rr
rrTKs)�context�dialectr]r^r_Zresult_column_structr$�_merge_cursor_descriptionr�_baserowproxy_usecext�updater�dict�set�lower�add�_translate_colname)
rr�cursor_descriptionrhri�result_columns�cols_are_ordered�textual_ordered�num_ctx_cols�raw�seen�recr.r
)rfrcrrr�s`







zResultMetaData.__init__cs��jj�|rJ|rJ|sJ|t��krJdd�|D�|_���fdd�t|�D�S|r^|���|�}n |rr|���|�}n|����}�fdd�|D�SdS)a�Merge a cursor.description with compiled result column information.

        There are at least four separate strategies used here, selected
        depending on the type of SQL construct used to start with.

        The most common case is that of the compiled SQL expression construct,
        which generated the column names present in the raw SQL string and
        which has the identical number of columns as were reported by
        cursor.description.  In this case, we assume a 1-1 positional mapping
        between the entries in cursor.description and the compiled object.
        This is also the most performant case as we disregard extracting /
        decoding the column names present in cursor.description since we
        already have the desired name we generated in the compiled SQL
        construct.

        The next common case is that of the completely raw string SQL,
        such as passed to connection.execute().  In this case we have no
        compiled construct to work with, so we extract and decode the
        names from cursor.description and index those as the primary
        result row target keys.

        The remaining fairly common case is that of the textual SQL
        that includes at least partial column information; this is when
        we use a :class:`.TextAsFrom` construct.   This construct may have
        unordered or ordered column information.  In the ordered case, we
        merge the cursor.description and the compiled construct's information
        positionally, and warn if there are additional description names
        present, however we still decode the names in cursor.description
        as we don't have a guarantee that the names in the columns match
        on these.   In the unordered case, we match names in cursor.description
        to that of the compiled construct based on name matching.
        In both of these cases, the cursor.description names and the column
        expression objects and names are indexed as result row target keys.

        The final case is much less common, where we have a compiled
        non-textual SQL expression construct, but the number of columns
        in cursor.description doesn't match what's in the compiled
        construct.  We make the guess here that there might be textual
        column expressions in the compiled construct that themselves include
        a comma in them causing them to split.  We do the same name-matching
        as with textual non-ordered columns.

        The name-matched system of merging is the same as that used by
        SQLAlchemy for all cases up through te 0.9 series.   Positional
        matching for compiled SQL expressions was introduced in 1.0 as a
        major performance feature, and positional matching for textual
        :class:`.TextAsFrom` objects in 1.1.  As name matching is no longer
        a common case, it was acceptable to factor it into smaller generator-
        oriented methods that are easier to understand, but incur slightly
        more performance overhead.

        cSsg|]}|d�qS)rr
)rSrbr
r
rrT�sz<ResultMetaData._merge_cursor_description.<locals>.<listcomp>csFg|]>\}\}}}}||�s$|��n|��||�|d�|df�qS)rdN)ro�get_result_processor)rS�idxr.r4r�type_)r]rhrrr
rrT�s
c
s2g|]*\}}}}}}|||��|||�||f�qSr
)rz)rSr{�colname�mapped_type�coltyper�untranslated)rhr
rrT�sN)rir]r$rU�	enumerate�_merge_textual_cols_by_position�_merge_cols_by_name�_merge_cols_by_none)rrhrrrsrvrtruZraw_iteratorr
)r]rhrrrrjNs$>

z(ResultMetaData._merge_cursor_descriptionc
cs�|j}|j}|j}|jr|jnd}|jr.|jnd}d}g|_xrt|�D]f\}	}
|
d}|
d}|rj||�}|rz||�\}}|r�||�}|j�	|�|s�|�
�}|	|||fVqFWdS)z�Extract column names and data types from a cursor.description.

        Applies unicode decoding, column translation, "normalization",
        and case sensitivity rules to the names based on the dialect.

        Nrrd)rir]rqZdescription_encodingZ_description_decoderZrequires_name_normalize�normalize_namerUr�r+ro)
rrhrrrir]Ztranslate_colnameZdescription_decoderr�r�r{ryr}rr
r
r�_colnames_from_description�s*z)ResultMetaData._colnames_from_descriptionc
cs�|rt|�nd}|t|�kr2t�d|t|�f�t�}x�|�||�D]v\}}}}	||kr�||}
|
d}|
d}|d|kr�t�d|d��|�|d�n
tj	}d}||||	||fVqFWdS)NzVNumber of columns in textual SQL (%d) is smaller than number of columns requested (%d)rr`rz8Duplicate column expression requested in textual SQL: %r)
r$r�warnrnr�rr-rpr�NULLTYPE)
rrhrrrsrvrxr{r}r�r�ctx_recrr~r
r
rr��s(z.ResultMetaData._merge_textual_cols_by_positionc	cs�|j}|j}|�||�}d|_xj|�||�D]Z\}}}	}
y||}Wntk
rbtj}d}
YnX|d}
|d}||||
|
|	fVq,WdS)NTrdr)rir]�_create_result_mapr^r�r&rr�)rrhrrrsrir]Z
result_mapr{r}r�rr�r~rr
r
rr�s
z"ResultMetaData._merge_cols_by_nameccs6x0|�||�D] \}}}}||tj|d|fVqWdS)N)r�rr�)rrhrrr{r}r�rr
r
rr�/sz"ResultMetaData._merge_cols_by_noneTc
Csni}xd|D]\}|d|dd�}}|s0|��}||kr^||\}}}	|||d|	f||<q
|||<q
W|S)Nrrd)ro)
rrsr]�drbr.ryZe_nameZe_objZe_typer
r
rr�8s
z!ResultMetaData._create_result_mapcCs$|j}d}t|tj�r0|�|jr$|n|���}n�t|tj�r�|j	rx|jrN|j	n|j	��|krx||jrj|j	n|j	��}n>t
|d�r�|jr�|jn|j��|kr�||jr�|jn|j��}|dk	r�|ddk	r�x |dD]}|�|�r�Pq�Wd}|dk�r|�rt
�dt�|���ndSn|||<|S)Nr4rdz.Could not locate column in row for column '%s')rr)r�string_types�getr]rorZ
ColumnElementZ_label�hasattrr4Z_compare_name_for_resultrZNoSuchColumnErrorZ_string_or_unprintable)rr.�raiseerrZmap_�resultrr
r
rr'Js8


zResultMetaData._key_fallbackcCs"||jkrdS|�|d�dk	SdS)NTF)rr')rr.r
r
rr<{s
zResultMetaData._has_keycCs^||jkr|j|\}}}n"|�||�}|dkr4dS|\}}}|dkrTt�d|��t�|�S)Nz<Ambiguous column name '%s' in result set column descriptions)rr'rr-rA�
itemgetter)rr.r�r!rr/�retr
r
r�_getter�s

zResultMetaData._gettercCs(tdd�|j��D��|j|j|jd�S)Ncss2|]*\}\}}}t|tjtj�r||fVqdS)N)r)rr�Z	int_types)rSr.r!rr/r
r
r�	<genexpr>�sz.ResultMetaData.__getstate__.<locals>.<genexpr>)�_pickled_keymaprUr]r^)rmrrVrUr]r^)rr
r
rr�szResultMetaData.__getstate__cCspdd�tt|d��D�|_i|_}x&|d��D]\}}dd|f||<q4W|d|_|d|_|d|_dS)NcSsg|]}d�qS)Nr
)rS�_r
r
rrT�sz/ResultMetaData.__setstate__.<locals>.<listcomp>rUr�r]r^)�ranger$rrrVrUr]r^)rr	rr.r/r
r
rr�s


zResultMetaData.__setstate__N)T)T)T)r7r8r9rZr:rrjr�r�r�r��classmethodr�r'r<r�rrr
r
r
rr\�sw*"	
1
r\c@sVeZdZdZeZdZdZdZdZ	dZ
dd�ZdGdd�Zd	d
�Z
dd�Zd
d�Zejdd��Zedd��Zedd��Zedd��Zdd�Zdd�Zdd�Zdd�Zdd �ZeZejd!d"��Zd#d$�Zd%d&�Zed'd(��Z d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$d1d2�Z%d3d4�Z&dHd5d6�Z'd7d8�Z(d9d:�Z)d;d<�Z*d=d>�Z+dId?d@�Z,dAdB�Z-dCdD�Z.dEdF�Z/dS)J�ResultProxya[Wraps a DB-API cursor object to provide easier access to row columns.

    Individual columns may be accessed by their integer position,
    case-insensitive column name, or by ``schema.Column``
    object. e.g.::

      row = fetchone()

      col1 = row[0]    # access via integer position

      col2 = row['col2']   # access via name

      col3 = row[mytable.c.mycol] # access via Column object.

    ``ResultProxy`` also handles post-processing of result column
    data using ``TypeEngine`` objects, which are referenced from
    the originating SQL statement that produced this result set.

    NFcCsD||_|j|_|j|_|_|j|_|jjo4|j��|_|�	�dS)N)
rhri�cursor�
_saved_cursorZroot_connection�
connection�_echo�engineZ_should_log_debug�_init_metadata)rrhr
r
rr�szResultProxy.__init__TcCs6y|jj}Wntk
r&|�d�SX|||�SdS)N)�	_metadatar�r2�_non_result)rr.r��getterr
r
rr��s
zResultProxy._gettercCs4y|jj}Wntk
r&|�d�SX||�SdS)N)r�r<r2r�)rr.rRr
r
rr<�s
zResultProxy._has_keycCs�|��}|dk	r�|jjrTd|jjkrT|jjjr<|jjj|_q`t||�|_|jj_nt||�|_|jr�|jjj	�
dtdd�|D���dS)NZcompiled_cachezCol %rcss|]}|dVqdS)rNr
)rS�xr
r
rr��sz-ResultProxy._init_metadata.<locals>.<genexpr>)�_cursor_descriptionrh�compiled�execution_optionsZ_cached_metadatar�r\r�r��logger�debugr,)rrrr
r
rr��s

zResultProxy._init_metadatacCs|jr|jjSgSdS)z/Return the current set of string keys for rows.N)r�rU)rr
r
rrU�szResultProxy.keysc
CsHy|jjStk
rB}z|j�|dd|j|j�Wdd}~XYnXdS)a�Return the 'rowcount' for this result.

        The 'rowcount' reports the number of rows *matched*
        by the WHERE criterion of an UPDATE or DELETE statement.

        .. note::

           Notes regarding :attr:`.ResultProxy.rowcount`:


           * This attribute returns the number of rows *matched*,
             which is not necessarily the same as the number of rows
             that were actually *modified* - an UPDATE statement, for example,
             may have no net change on a given row if the SET values
             given are the same as those present in the row already.
             Such a row would be matched but not modified.
             On backends that feature both styles, such as MySQL,
             rowcount is configured by default to return the match
             count in all cases.

           * :attr:`.ResultProxy.rowcount` is *only* useful in conjunction
             with an UPDATE or DELETE statement.  Contrary to what the Python
             DBAPI says, it does *not* return the
             number of rows available from the results of a SELECT statement
             as DBAPIs cannot support this functionality when rows are
             unbuffered.

           * :attr:`.ResultProxy.rowcount` may not be fully implemented by
             all dialects.  In particular, most DBAPIs do not support an
             aggregate rowcount result from an executemany call.
             The :meth:`.ResultProxy.supports_sane_rowcount` and
             :meth:`.ResultProxy.supports_sane_multi_rowcount` methods
             will report from the dialect if each usage is known to be
             supported.

           * Statements that use RETURNING may not return a correct
             rowcount.

        N)rh�rowcount�
BaseExceptionr��_handle_dbapi_exceptionr�)rr5r
r
rr��s
)zResultProxy.rowcountc
CsHy|jjStk
rB}z|j�|dd|j|j�Wdd}~XYnXdS)a/return the 'lastrowid' accessor on the DBAPI cursor.

        This is a DBAPI specific method and is only functional
        for those backends which support it, for statements
        where it is appropriate.  It's behavior is not
        consistent across backends.

        Usage of this method is normally unnecessary when
        using insert() expression constructs; the
        :attr:`~ResultProxy.inserted_primary_key` attribute provides a
        tuple of primary key values for a newly inserted row,
        regardless of database backend.

        N)r��	lastrowidr�r�r�rh)rr5r
r
rr�-s
zResultProxy.lastrowidcCs
|jdk	S)z�True if this :class:`.ResultProxy` returns rows.

        I.e. if it is legal to call the methods
        :meth:`~.ResultProxy.fetchone`,
        :meth:`~.ResultProxy.fetchmany`
        :meth:`~.ResultProxy.fetchall`.

        N)r�)rr
r
r�returns_rowsDs
zResultProxy.returns_rowscCs|jjS)adTrue if this :class:`.ResultProxy` is the result
        of a executing an expression language compiled
        :func:`.expression.insert` construct.

        When True, this implies that the
        :attr:`inserted_primary_key` attribute is accessible,
        assuming the statement did not include
        a user defined "returning" construct.

        )rh�isinsert)rr
r
r�	is_insertPszResultProxy.is_insertcCs|jjS)z May be overridden by subclasses.)r��description)rr
r
rr�^szResultProxy._cursor_descriptioncCs<|jr
dSd|_|j}|j�|�|jr2|j��d|_dS)alSoft close this :class:`.ResultProxy`.

        This releases all DBAPI cursor resources, but leaves the
        ResultProxy "open" from a semantic perspective, meaning the
        fetchXXX() methods will continue to return empty results.

        This method is called automatically when:

        * all result rows are exhausted using the fetchXXX() methods.
        * cursor.description is None.

        This method is **not public**, but is documented in order to clarify
        the "autoclose" process used.

        .. versionadded:: 1.0.0

        .. seealso::

            :meth:`.ResultProxy.close`


        NT)�_soft_closedr�r�Z_safe_close_cursor�_autoclose_connection�close)rr�r
r
r�_soft_closecs
zResultProxy._soft_closecCs|js|��d|_dS)aClose this ResultProxy.

        This closes out the underlying DBAPI cursor corresponding
        to the statement execution, if one is still present.  Note that the
        DBAPI cursor is automatically released when the :class:`.ResultProxy`
        exhausts all available rows.  :meth:`.ResultProxy.close` is generally
        an optional method except in the case when discarding a
        :class:`.ResultProxy` that still has additional rows pending for fetch.

        In the case of a result that is the product of
        :ref:`connectionless execution <dbengine_implicit>`,
        the underlying :class:`.Connection` object is also closed, which
        :term:`releases` DBAPI connection resources.

        After this method is called, it is no longer valid to call upon
        the fetch methods, which will raise a :class:`.ResourceClosedError`
        on subsequent use.

        .. versionchanged:: 1.0.0 - the :meth:`.ResultProxy.close` method
           has been separated out from the process that releases the underlying
           DBAPI cursor resource.   The "auto close" feature of the
           :class:`.Connection` now performs a so-called "soft close", which
           releases the underlying DBAPI cursor, but allows the
           :class:`.ResultProxy` to still behave as an open-but-exhausted
           result set; the actual :meth:`.ResultProxy.close` method is never
           called.    It is still safe to discard a :class:`.ResultProxy`
           that has been fully exhausted without calling this method.

        .. seealso::

            :ref:`connections_toplevel`

            :meth:`.ResultProxy._soft_close`

        TN)�closedr�)rr
r
rr��s%zResultProxy.closeccs$x|��}|dkrdS|VqWdS)zImplement iteration protocol.N)�fetchone)rrr
r
rr#�s
zResultProxy.__iter__cCs |��}|dkrt��n|SdS)zGImplement the next() protocol.

        .. versionadded:: 1.2

        N)r��
StopIteration)rrr
r
r�__next__�szResultProxy.__next__cCsB|jjst�d��n&|jjs(t�d��n|jjr:t�d��|jjS)a�Return the primary key for the row just inserted.

        The return value is a list of scalar values
        corresponding to the list of primary key columns
        in the target table.

        This only applies to single row :func:`.insert`
        constructs which did not explicitly specify
        :meth:`.Insert.returning`.

        Note that primary key columns which specify a
        server_default clause,
        or otherwise do not qualify as "autoincrement"
        columns (see the notes at :class:`.Column`), and were
        generated using the database-side default, will
        appear in this list as ``None`` unless the backend
        supports "returning" and the insert statement executed
        with the "implicit returning" enabled.

        Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
        statement is not a compiled expression construct
        or is not an insert() construct.

        z1Statement is not a compiled expression construct.z2Statement is not an insert() expression construct.z9Can't call inserted_primary_key when returning() is used.)rhr�rr-r�Z_is_explicit_returning�inserted_primary_key)rr
r
rr��sz ResultProxy.inserted_primary_keycCsH|jjst�d��n0|jjs(t�d��n|jjr8|jjS|jjdSdS)aReturn the collection of updated parameters from this
        execution.

        Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
        statement is not a compiled expression construct
        or is not an update() construct.

        z1Statement is not a compiled expression construct.z2Statement is not an update() expression construct.rN)rhr�rr-�isupdate�executemany�compiled_parameters)rr
r
r�last_updated_params�s	zResultProxy.last_updated_paramscCsH|jjst�d��n0|jjs(t�d��n|jjr8|jjS|jjdSdS)aReturn the collection of inserted parameters from this
        execution.

        Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
        statement is not a compiled expression construct
        or is not an insert() construct.

        z1Statement is not a compiled expression construct.z2Statement is not an insert() expression construct.rN)rhr�rr-r�r�r�)rr
r
r�last_inserted_paramss	z ResultProxy.last_inserted_paramscCs|jjS)a�Return the values of default columns that were fetched using
        the :meth:`.ValuesBase.return_defaults` feature.

        The value is an instance of :class:`.RowProxy`, or ``None``
        if :meth:`.ValuesBase.return_defaults` was not used or if the
        backend does not support RETURNING.

        .. versionadded:: 0.9.0

        .. seealso::

            :meth:`.ValuesBase.return_defaults`

        )rh�returned_defaults)rr
r
rr�szResultProxy.returned_defaultscCs
|j��S)z�Return ``lastrow_has_defaults()`` from the underlying
        :class:`.ExecutionContext`.

        See :class:`.ExecutionContext` for details.

        )rh�lastrow_has_defaults)rr
r
rr�.sz ResultProxy.lastrow_has_defaultscCs6|jjst�d��n|jjs.|jjs.t�d��|jjS)aMReturn ``postfetch_cols()`` from the underlying
        :class:`.ExecutionContext`.

        See :class:`.ExecutionContext` for details.

        Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
        statement is not a compiled expression construct
        or is not an insert() or update() construct.

        z1Statement is not a compiled expression construct.z>Statement is not an insert() or update() expression construct.)rhr�rr-r�r��postfetch_cols)rr
r
rr�8szResultProxy.postfetch_colscCs6|jjst�d��n|jjs.|jjs.t�d��|jjS)aLReturn ``prefetch_cols()`` from the underlying
        :class:`.ExecutionContext`.

        See :class:`.ExecutionContext` for details.

        Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
        statement is not a compiled expression construct
        or is not an insert() or update() construct.

        z1Statement is not a compiled expression construct.z>Statement is not an insert() or update() expression construct.)rhr�rr-r�r��
prefetch_cols)rr
r
rr�OszResultProxy.prefetch_colscCs|jjS)zxReturn ``supports_sane_rowcount`` from the dialect.

        See :attr:`.ResultProxy.rowcount` for background.

        )ri�supports_sane_rowcount)rr
r
rr�fsz"ResultProxy.supports_sane_rowcountcCs|jjS)z~Return ``supports_sane_multi_rowcount`` from the dialect.

        See :attr:`.ResultProxy.rowcount` for background.

        )ri�supports_sane_multi_rowcount)rr
r
rr�osz(ResultProxy.supports_sane_multi_rowcountcCs*y
|j��Stk
r$|�d�SXdS)N)r�r�r2r�)rr
r
r�_fetchone_implxs
zResultProxy._fetchone_implcCsBy"|dkr|j��S|j�|�SWntk
r<|�g�SXdS)N)r��	fetchmanyr2r�)r�sizer
r
r�_fetchmany_impl~s
zResultProxy._fetchmany_implcCs*y
|j��Stk
r$|�g�SXdS)N)r��fetchallr2r�)rr
r
r�_fetchall_impl�s
zResultProxy._fetchall_implcCs0|jdkrt�d��n|jr(t�d��n|SdS)NzJThis result object does not return rows. It has been closed automatically.zThis result object is closed.)r�rZResourceClosedErrorr�)r�defaultr
r
rr��s
zResultProxy._non_resultcs�|j�|j��j��j�|jrd|jjjj}g}x0|D](}|dt	�
|��|���|����q4W|S����fdd�|D�SdS)NzRow %rcsg|]}��|����qSr
r
)rSr)r�metadata�process_rowrr
rrT�sz,ResultProxy.process_rows.<locals>.<listcomp>)�_process_rowr�rrr�rhr�r�r�rOrPr+)rZrows�logr0rr
)rr�r�rr�process_rows�s
zResultProxy.process_rowsc
CsZy|�|���}|��|Stk
rT}z|j�|dd|j|j�Wdd}~XYnXdS)avFetch all rows, just like DB-API ``cursor.fetchall()``.

        After all rows have been exhausted, the underlying DBAPI
        cursor resource is released, and the object may be safely
        discarded.

        Subsequent calls to :meth:`.ResultProxy.fetchall` will return
        an empty list.   After the :meth:`.ResultProxy.close` method is
        called, the method will raise :class:`.ResourceClosedError`.

        .. versionchanged:: 1.0.0 - Added "soft close" behavior which
           allows the result to be used in an "exhausted" state prior to
           calling the :meth:`.ResultProxy.close` method.

        N)r�r�r�r�r�r�r�rh)rr0r5r
r
rr��szResultProxy.fetchallc
Cshy(|�|�|��}t|�dkr&|��|Stk
rb}z|j�|dd|j|j�Wdd}~XYnXdS)a�Fetch many rows, just like DB-API
        ``cursor.fetchmany(size=cursor.arraysize)``.

        After all rows have been exhausted, the underlying DBAPI
        cursor resource is released, and the object may be safely
        discarded.

        Calls to :meth:`.ResultProxy.fetchmany` after all rows have been
        exhausted will return
        an empty list.   After the :meth:`.ResultProxy.close` method is
        called, the method will raise :class:`.ResourceClosedError`.

        .. versionchanged:: 1.0.0 - Added "soft close" behavior which
           allows the result to be used in an "exhausted" state prior to
           calling the :meth:`.ResultProxy.close` method.

        rN)	r�r�r$r�r�r�r�r�rh)rr�r0r5r
r
rr��szResultProxy.fetchmanyc
Cspy0|��}|dk	r"|�|g�dS|��dSWn:tk
rj}z|j�|dd|j|j�Wdd}~XYnXdS)a�Fetch one row, just like DB-API ``cursor.fetchone()``.

        After all rows have been exhausted, the underlying DBAPI
        cursor resource is released, and the object may be safely
        discarded.

        Calls to :meth:`.ResultProxy.fetchone` after all rows have
        been exhausted will return ``None``.
        After the :meth:`.ResultProxy.close` method is
        called, the method will raise :class:`.ResourceClosedError`.

        .. versionchanged:: 1.0.0 - Added "soft close" behavior which
           allows the result to be used in an "exhausted" state prior to
           calling the :meth:`.ResultProxy.close` method.

        Nr)r�r�r�r�r�r�r�rh)rrr5r
r
rr��szResultProxy.fetchonec
Cs�|jdkr|�d�Sy|��}Wn:tk
rZ}z|j�|dd|j|j�Wdd}~XYnXz |dk	rv|�|g�dSdSWd|�	�XdS)aFetch the first row and then close the result set unconditionally.

        Returns None if no row is present.

        After calling this method, the object is fully closed,
        e.g. the :meth:`.ResultProxy.close` method will have been called.

        Nr)
r�r�r�r�r�r�r�rhr�r�)rrr5r
r
r�first�s	

$zResultProxy.firstcCs |��}|dk	r|dSdSdS)aFetch the first column of the first row, and close the result set.

        Returns None if no row is present.

        After calling this method, the object is fully closed,
        e.g. the :meth:`.ResultProxy.close` method will have been called.

        Nr)r�)rrr
r
r�scalars	zResultProxy.scalar)T)N)N)0r7r8r9rZr;r�Zout_parametersr�r�r�r�rr�r<r�rUrZmemoized_propertyr��propertyr�r�r�r�r�r�r#r��nextr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rr��sR

0 )
,
		
	
r�c	sdeZdZdZ�fdd�Zdddddd	d
dd�Zd
d�Z�fdd�Zdd�Zddd�Z	dd�Z
�ZS)�BufferedRowResultProxya�A ResultProxy with row buffering behavior.

    ``ResultProxy`` that buffers the contents of a selection of rows
    before ``fetchone()`` is called.  This is to allow the results of
    ``cursor.description`` to be available immediately, when
    interfacing with a DB-API that requires rows to be consumed before
    this information is available (currently psycopg2, when used with
    server-side cursors).

    The pre-fetching behavior fetches only one row initially, and then
    grows its buffer size by a fixed amount with each successive need
    for additional rows up to a size of 1000.

    The size argument is configurable using the ``max_row_buffer``
    execution option::

        with psycopg2_engine.connect() as conn:

            result = conn.execution_options(
                stream_results=True, max_row_buffer=50
                ).execute("select * from table")

    .. versionadded:: 1.0.6 Added the ``max_row_buffer`` option.

    .. seealso::

        :ref:`psycopg2_execution_options`
    cs,|jj�dd�|_|��tt|���dS)NZmax_row_buffer)rhr�r��_max_row_buffer�$_BufferedRowResultProxy__buffer_rows�superr�r�)r)rr
rr�Fs
z%BufferedRowResultProxy._init_metadatarg�
��2�d�i�i�)rdrgr�r�r�r�r�i�cCs\|jdkrdSt|dd�}t�|j�|��|_|j�||�|_|j	dk	rXt
|j	|j�|_dS)N�_bufsizerd)r��getattr�collections�dequer��"_BufferedRowResultProxy__rowbuffer�size_growthr�r�r��min)rr�r
r
rZ
__buffer_rows\s

z$BufferedRowResultProxy.__buffer_rowscs |j��tt|�jf|�dS)N)r��clearr�r�r�)r�kw)rr
rr�es
z"BufferedRowResultProxy._soft_closecCs6|jdkr|�d�S|js,|��|js,dS|j��S)N)r�r�r�r��popleft)rr
r
rr�is

z%BufferedRowResultProxy._fetchone_implNcCsH|dkr|��Sg}x.td|�D] }|��}|dkr6P|�|�q W|S)Nr)r�r�r�r+)rr�r�r�rr
r
rr�rsz&BufferedRowResultProxy._fetchmany_implcCs:|jdkr|�g�S|j�|j���|j}t��|_|S)N)r�r�r��extendr�r�r�)rr�r
r
rr�}s


z%BufferedRowResultProxy._fetchall_impl)N)r7r8r9rZr�r�r�r�r�r�r��
__classcell__r
r
)rrr�(s		
r�csNeZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zddd�Zd
d�Z	�Z
S)�FullyBufferedResultProxyz�A result proxy that buffers rows fully upon creation.

    Used for operations where a result is to be delivered
    after the database conversation can not be continued,
    such as MSSQL INSERT...OUTPUT after an autocommit.

    cstt|���|��|_dS)N)r�r�r��_buffer_rows�$_FullyBufferedResultProxy__rowbuffer)r)rr
rr��sz'FullyBufferedResultProxy._init_metadatacCst�|j���S)N)r�r�r�r�)rr
r
rr��sz%FullyBufferedResultProxy._buffer_rowscs |j��tt|�jf|�dS)N)r�r�r�r�r�)rr�)rr
rr��s
z$FullyBufferedResultProxy._soft_closecCs|jr|j��S|�d�SdS)N)r�r�r�)rr
r
rr��s
z'FullyBufferedResultProxy._fetchone_implNcCsH|dkr|��Sg}x.td|�D] }|��}|dkr6P|�|�q W|S)Nr)r�r�r�r+)rr�r�r�rr
r
rr��sz(FullyBufferedResultProxy._fetchmany_implcCs$|js|�g�S|j}t��|_|S)N)r�r�r�r�r�)rr�r
r
rr��s


z'FullyBufferedResultProxy._fetchall_impl)N)r7r8r9rZr�r�r�r�r�r�r�r
r
)rrr��s
r�cseZdZ�fdd�Z�ZS)�BufferedColumnRowcs^t|�}d}x.|jD]$}|dk	r0|||�||<|d7}qWt|�}tt|��||||�dS)Nrrd)rr_r,r�r�r)rrrrrr/r!)rr
rr�s
zBufferedColumnRow.__init__)r7r8r9rr�r
r
)rrr��sr�cs6eZdZdZeZ�fdd�Zdd�Zd	dd�Z�Z	S)
�BufferedColumnResultProxya�A ResultProxy with column buffering behavior.

    ``ResultProxy`` that loads all columns into memory each time
    fetchone() is called.  If fetchmany() or fetchall() are called,
    the full grid of results is fetched.  This is to operate with
    databases where result rows contain "live" results that fall out
    of scope unless explicitly fetched.

    .. versionchanged:: 1.2  This :class:`.ResultProxy` is not used by
       any SQLAlchemy-included dialects.

    csztt|���|j}|jdkrv|j|_dd�tt|j��D�|_i}x*|j	�
�D]\}\}}}d||f||<qPW||_	dS)NcSsg|]}d�qS)Nr
)rSr�r
r
rrT�sz<BufferedColumnResultProxy._init_metadata.<locals>.<listcomp>)r�r�r�r�r_rr�r$rUrrV)rr�r�k�funcrr/)rr
rr��s
z(BufferedColumnResultProxy._init_metadatacCs*g}x |��}|dkrP|�|�qW|S)N)r�r+)rr0rr
r
rr��sz"BufferedColumnResultProxy.fetchallNcCsF|dkr|��Sg}x,t|�D] }|��}|dkr4P|�|�qW|S)N)r�r�r�r+)rr�r0�irr
r
rr��sz#BufferedColumnResultProxy.fetchmany)N)
r7r8r9rZr�r�r�r�r�r�r
r
)rrr��s
r�)rZr�rA�rrZsqlrrrOZsqlalchemy.cresultproxyrr�ImportErrorrrk�objectr;Zcollections_abc�Sequence�registerr\r�r�r�r�r�r
r
r
r�<module>	sJBLe^-

Youez - 2016 - github.com/yon3zu
LinuXploit