https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/trac/db/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/trac/db/__pycache__/util.cpython-310.pyc
o

�k�`E�@sNddlZddlmZe�dej�Zdd�ZGdd�de�ZGdd	�d	e�Z	dS)
�N)�closingzA
    '(?:[^']+|'')*' |
    `(?:[^`]+|``)*` |
    "(?:[^"]+|"")*" cCsdd�}t�||�S)NcSs|�d��dd�S)Nr�%z%%)�group�replace)�match�r�./usr/lib/python3/dist-packages/trac/db/util.py�replsz sql_escape_percent.<locals>.repl)�_sql_escape_percent_re�sub)�sqlr	rrr�sql_escape_percentsr
c@sDeZdZdZddgZddd�Zdd�Zd	d
�Zddd�Zd
d�Z	dS)�IterableCursorz�Wrapper for DB-API cursor objects that makes the cursor iterable
    and escapes all "%"s used inside literal strings with parameterized
    queries.

    Iteration will generate the rows of a SELECT query one by one.
    �cursor�logNcCs||_||_dS�N)rr)�selfrrrrr�__init__*s
zIterableCursor.__init__cCst|j|�Sr)�getattrr�r�namerrr�__getattr__.szIterableCursor.__getattr__ccs�	|j��}|sdS|Vqr)r�fetchone)r�rowrrr�__iter__1s�
�zIterableCursor.__iter__c
Cs�|jrO|j�d|�z0|r|j�d|�|j�t|�|�}n|j�|�}t|jdd�}|dur8|j�dt|��|WStyN}z|j�d|��d}~ww|rZ|j�t|�|�S|j�|�S)NzSQL: %s�args: %r�rowszprefetch: %d rowszexecute exception: %r)r�debugr�executer
r�len�	Exception)rr�args�rr�errrr8s&��zIterableCursor.executec
Cs�|jr@|j�d|�|j�d|�|sdSz|dr$|j�t|�|�WS|j�||�WSty?}z|j�d|��d}~ww|sDdS|drQ|j�t|�|�S|j�||�S)NzSQL: %rrrzexecutemany exception: %r)rrr�executemanyr
r )rrr!r#rrrr$Ls*���zIterableCursor.executemanyr)
�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrr$rrrrr!s

rc@sFeZdZdZdZddd�Zdd�Zdd	d
�ZeZddd�Z	d
d�Z
dS)�ConnectionWrappera!Generic wrapper around connection objects.

    :since 0.12: This wrapper no longer makes cursors produced by the
                 connection iterable using `IterableCursor`.

    :since 1.0: added a 'readonly' flag preventing the forwarding of
                `commit` and `rollback`
    ��cnxr�readonlyNFcCs||_||_||_dSrr+)rr,rr-rrrrls
zConnectionWrapper.__init__cCs|jr	|dvr	t�t|j|�S)N)�commit�rollback)r-�AttributeErrorrr,rrrrrqszConnectionWrapper.__getattr__cCsf|�|�}t|j����}|�||dur|ng�|r|��nd}Wd�|S1s,wY|S)aExecute an SQL `query`

        The optional `params` is a tuple containing the parameter
        values expected by the query.

        If the query is a SELECT, return all the rows ("fetchall").
        When more control is needed, use `cursor()`.
        N)�check_selectrr,rr�fetchall�r�query�params�dqlrrrrrrvs
	
��zConnectionWrapper.executecCsZ|�|�}t|j����}|�||�|r|��nd}Wd�|S1s&wY|S)a9Execute an SQL `query`, on a sequence of tuples ("executemany").

        The optional `params` is a sequence of tuples containing the
        parameter values expected by the query.

        If the query is a SELECT, return all the rows ("fetchall").
        When more control is needed, use `cursor()`.
        N)r1rr,rr$r2r3rrrr$�s
	
��zConnectionWrapper.executemanycCs$|���d�}|jr|std��|S)a	Verify if the query is compatible according to the readonly nature
        of the wrapped Connection.

        :return: `True` if this is a SELECT
        :raise: `ValueError` if this is not a SELECT and the wrapped
                Connection is read-only.
        �SELECTz,a 'readonly' connection can only do a SELECT)�lstrip�
startswithr-�
ValueError)rr4r6rrrr1�s
zConnectionWrapper.check_select)NFr)r%r&r'r(r)rrr�__call__r$r1rrrrr*as


r*)
�re�
contextlibr�compile�VERBOSEr
r
�objectrr*rrrr�<module>s�@

https://t.me/RX1948 - 2025