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/MySQLdb/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/MySQLdb/__pycache__/connections.cpython-310.pyc
o

���]1�@s�dZddlZddlZddlmZmZddlmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZddddd	d
�Ze�d�Zdd
�ZGdd�dej�ZdS)a
This module implements connections for MySQLdb. Presently there is
only one class: Connection. Others are unlikely. However, you might
want to make your own subclasses. In most cases, you will probably
override Connection.default_cursor with a non-standard Cursor class.
�N)�cursors�_mysql)�unicode�PY2)
�Warning�Error�InterfaceError�	DataError�
DatabaseError�OperationalError�IntegrityError�
InternalError�NotSupportedError�ProgrammingError�utf8�cp1252�koi8_r�koi8_u)�utf8mb4�utf8mb3�latin1�koi8r�koi8uz^(\d+)cCs t�|�}|rt|�d��SdS)z�Returns the leading numeric part of a string.

    >>> numeric_part("20-alpha")
    20
    >>> numeric_part("foo")
    >>> numeric_part("16b")
    16
    �N)�re_numeric_part�match�int�group)�s�m�r �5/usr/lib/python3/dist-packages/MySQLdb/connections.py�numeric_parts

r"cs�eZdZdZejZ�fdd�Zdd�Zddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zeejd�s6dd�Z�fdd�Zdd�Zdd�ZeZeZeZeZeZeZeZeZeZeZ�Z S)�
Connectionz MySQL Database Connection Objectcs�ddlm}m}ddlm}m}ddlm}|��}d|vr%|�	d�|d<d|vr0|�	d�|d<d	|vr9|d	}	n|}	i}
|	�
�D]\}}t|t�rXt|t
�rX|d
d
�|
|<qA||
|<qA|
|d	<|�	d|j�}
|�dd
�}|srtsud}nd}|�	d|�}|�	dd
�}|�	dd�|_|�dd�}tdd�t���d�d
d�D��}|dkr�||jO}|dkr�||jO}||d<|�	dd�}tt|�j|i|��|
|_tdd�|	�
�D��|_t|jt<tdd�|���d�d
d�D��|_ d|_!||��d �fdd�	}|�s|�"�}|�#|�|�r|�$|�|�r4|j%|j&|j'|j(|j)|j*|j+fD]}||j,|<�q%t-|j,|j.<||jt-<|j/|j0@|_1|j1�rN|d
u�rN|�2|�g|_3d
S)!a�

        Create a connection to the database. It is strongly recommended
        that you only use keyword parameters. Consult the MySQL C API
        documentation for more information.

        :param str host:        host to connect
        :param str user:        user to connect as
        :param str password:    password to use
        :param str passwd:      alias of password, for backward compatibility
        :param str database:    database to use
        :param str db:          alias of database, for backward compatibility
        :param int port:        TCP/IP port to connect to
        :param str unix_socket: location of unix_socket to use
        :param dict conv:       conversion dictionary, see MySQLdb.converters
        :param int connect_timeout:
            number of seconds to wait before the connection attempt fails.

        :param bool compress:   if set, compression is enabled
        :param str named_pipe:  if set, a named pipe is used to connect (Windows only)
        :param str init_command:
            command which is run once the connection is created

        :param str read_default_file:
            file from which default client values are read

        :param str read_default_group:
            configuration group to use from the default file

        :param type cursorclass:
            class object, used to create cursors (keyword only)

        :param bool use_unicode:
            If True, text-like columns are returned as unicode objects
            using the connection's character set. Otherwise, text-like
            columns are returned as bytes. Unicode objects will always
            be encoded to the connection's character set regardless of
            this setting.
            Default to False on Python 2 and True on Python 3
            so that you can always get python `str` object by default.

        :param str charset:
            If supplied, the connection character set will be changed
            to this character set.
            On Python 2, this option changes default value of `use_unicode`
            option from False to True.

        :param str auth_plugin:
            If supplied, the connection default authentication plugin will be
            changed to this value. Example values:
            `mysql_native_password` or `caching_sha2_password`

        :param str sql_mode:
            If supplied, the session SQL mode will be changed to this
            setting.
            For more details and legal values, see the MySQL documentation.

        :param int client_flag:
            flags to use or 0 (see MySQL docs or constants/CLIENTS.py)

        :param dict ssl:
            dictionary or mapping contains SSL connection parameters;
            see the MySQL documentation for more details
            (mysql_ssl_set()).  If this is set, and the client does not
            support SSL, NotSupportedError will be raised.

        :param bool local_infile:
            enables LOAD LOCAL INFILE; zero disables

        :param bool autocommit:
            If False (default), autocommit is disabled.
            If True, autocommit is enabled.
            If None, autocommit isn't set and server default is used.

        :param bool binary_prefix:
            If set, the '_binary' prefix will be used for raw byte query
            arguments (e.g. Binary). This is disabled by default.

        There are a number of undocumented, non-standard methods. See the
        documentation for the MySQL C API for some hints on what they do.
        r)�CLIENT�
FIELD_TYPE)�conversions�
_bytes_or_str)�proxy�database�db�password�passwd�convN�cursorclass�charset�TF�use_unicode�sql_mode�
binary_prefix�client_flagcS�g|]}t|��qSr �r"��.0�nr r r!�
<listcomp>��z'Connection.__init__.<locals>.<listcomp>�.���r)�r�
autocommitcSs$g|]\}}t|�tur||f�qSr )�typer)r8�k�vr r r!r:�s�cSr5r r6r7r r r!r:�r;�asciics��|��j��S�N)�string_literal�encode�encoding)�u�dummy�r*r r!�unicode_literal�sz,Connection.__init__.<locals>.unicode_literalrF)4�MySQLdb.constantsr$r%�MySQLdb.convertersr&r'�weakrefr(�copy�pop�items�
isinstancer�list�default_cursor�getr�_binary_prefix�tupler�get_client_info�split�MULTI_STATEMENTS�
MULTI_RESULTS�superr#�__init__r.�dict�encoders�bytes�get_server_info�_server_versionrI�character_set_name�set_character_set�set_sql_mode�STRING�
VAR_STRING�VARCHAR�	TINY_BLOB�MEDIUM_BLOB�	LONG_BLOB�BLOB�	converterr�JSON�server_capabilities�TRANSACTIONS�_transactionalrA�messages)�self�args�kwargsr$r%r&r'r(�kwargs2r-�conv2rCrDr.r/r1r2r4�client_versionrArM�t��	__class__rLr!r_2stQ

$


&

�



zConnection.__init__cCs*t|�}|��|krtj�||�dSdSrF)�bool�get_autocommitr�
connectionrA)ru�onr r r!rA�s�zConnection.autocommitNcCs|p|j|�S)z�
        Create a cursor on which queries may be performed. The
        optional cursorclass parameter is used to create the
        Cursor. By default, self.cursorclass=cursors.Cursor is
        used.
        )r.)rur.r r r!�cursor�szConnection.cursorcCs$t|t�r	t|�}tj�||�dSrF)rT�	bytearrayrbrr��query)rur�r r r!r��s
zConnection.querycCs.t|ttf�s	J�|�|�}|jrd|S|S)Ns_binary)rTrbr�rGrX)ru�bs�xr r r!�_bytes_literal�s

zConnection._bytes_literalcCsdd�t|j|��S)Ns(%s)�,)�join�map�literal)rur{r r r!�_tuple_literal�szConnection._tuple_literalcCs�t|t�r|�|�|j��}n=t|t�r|�|�}n2t|t�r-tr'|�|�}n%|�|�}nt|t	t
f�r:|�|�}n|�||j
�}t|t�rL|�|j�}t|t�sSJ�|S)aIf o is a single object, returns an SQL literal as a string.
        If o is a non-string sequence, the items of the sequence are
        converted and returned as a sequence.

        Non-standard. For internal use; do not use this in your
        applications.
        )rTrrGrHrIr�r�rbrrYrUr��escapera)ru�orr r r!r��s



zConnection.literalcCs|�d�dS)ziExplicitly begin a connection.

        This method is not used when autocommit=False (default).
        sBEGINN)r�)rur r r!�beginszConnection.begin�
warning_countcCs |��}|rt|��d�SdS)zpReturn the number of warnings generated from the
            last query. This is derived from the info() method.���r)�inforr[)rur�r r r!r�szConnection.warning_countcsrt�||�}|��|kr4z
tt|��|�Wnty3|jdkr&td��|�	d|�|�
�Ynw||_dS)z�Set the connection character set to charset. The character
        set can only be changed in MySQL-4.1 and newer. If you try
        to change the character set from the current value in an
        older version, NotSupportedError will be raised.r>z server is too old to set charsetzSET NAMES %sN)�_charset_to_encodingrWrer^r#rf�AttributeErrorrdrr��store_resultrI)rur/�
py_charsetr|r r!rf's
�
zConnection.set_character_setcCs,|jdkr	td��|�d|�|��dS)zNSet the connection sql_mode. See MySQL documentation for
        legal values.r>z!server is too old to set sql_modezSET SESSION sql_mode='%s'N)rdrr�r�)rur2r r r!rg7s
zConnection.set_sql_modecCs.|jdkrdS|�d�|��}|�d�}|S)z�Return detailed information about warnings as a
        sequence of tuples of (Level, Code, Message). This
        is only supported in MySQL-4.1 and up. If your server
        is an earlier version, an empty sequence is returned.r>r z
SHOW WARNINGSr)rdr�r��	fetch_row)ru�r�warningsr r r!�
show_warnings?s


zConnection.show_warningsrF)!�__name__�
__module__�__qualname__�__doc__r�CursorrVr_rAr�r�r�r�r�r��hasattrrr�r�rfrgr�rrrr
r	rrr
rr�
__classcell__r r r|r!r#-s6,
		r#)r��re�sys�MySQLdbrr�MySQLdb.compatrr�MySQLdb._exceptionsrrrr	r
rrr
rrr��compilerr"r�r#r r r r!�<module>s0�


https://t.me/RX1948 - 2025