HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //proc/self/root/lib64/python3.6/site-packages/MySQLdb/__pycache__/connections.cpython-36.opt-1.pyc
3

���]1�@s�dZddlZddlZddlmZmZddlmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZddddd	d
�Zejd�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_rZkoi8_u)Zutf8mb4Zutf8mb3�latin1Zkoi8rZkoi8uz^(\d+)cCs tj|�}|rt|jd��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�#/usr/lib64/python3.6/connections.py�numeric_parts

rcs�eZdZdZejZ�fdd�Zdd�Zddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zeejd�sldd�Z�fdd�Zdd�Zdd�ZeZeZeZeZeZeZeZeZeZeZ�Z S)�
Connectionz MySQL Database Connection Objectcs�ddlm}m}ddlm}m}ddlm}|j�}d|krJ|j	d�|d<d|kr`|j	d�|d<d	|krr|d	}	n|}	i}
xB|	j
�D]6\}}t|t�r�t|t
�r�|d
d
�|
|<q�||
|<q�W|
|d	<|j	d|j�}
|jdd
�}|s�tr�d}nd}|j	d|�}|j	dd
�}|j	dd�|_|jdd�}tdd�tj�jd�d
d�D��}|d!k�r^||jO}|d"k�rr||jO}||d<|j	dd�}tt|�j||�|
|_tdd�|	j
�D��|_t|jt<tdd�|j�jd�d
d�D��|_ d|_!||��d#�fdd �	}|�s|j"�}|j#|�|�r*|j$|�|�rrx4|j%|j&|j'|j(|j)|j*|j+fD]}||j,|<�qRWt-|j,|j.<||jt-<|j/|j0@|_1|j1�r�|d
k	�r�|j2|�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)�proxyZdatabase�dbZpasswordZpasswd�convN�cursorclass�charset�TF�use_unicode�sql_modeZ
binary_prefix�client_flagcSsg|]}t|��qSr)r)�.0�nrrr�
<listcomp>�sz'Connection.__init__.<locals>.<listcomp>�.��r��
autocommitcSs$g|]\}}t|�tk	r||f�qSr)�typer)r,�k�vrrrr.�scSsg|]}t|��qSr)r)r,r-rrrr.�s�asciics�j|j�j��S)N)�string_literal�encode�encoding)�uZdummy)r$rr�unicode_literal�sz,Connection.__init__.<locals>.unicode_literal)r1r)r2r)N)4ZMySQLdb.constantsrr ZMySQLdb.convertersr!r"�weakrefr#�copy�pop�items�
isinstancer�list�default_cursor�getr�_binary_prefix�tuplerZget_client_info�splitZMULTI_STATEMENTSZ
MULTI_RESULTS�superr�__init__r&�dict�encoders�bytesZget_server_info�_server_versionr:�character_set_name�set_character_set�set_sql_mode�STRINGZ
VAR_STRINGZVARCHARZ	TINY_BLOBZMEDIUM_BLOBZ	LONG_BLOBZBLOBZ	converterrZJSONZserver_capabilitiesZTRANSACTIONSZ_transactionalr3Zmessages)�self�args�kwargsrr r!r"r#Zkwargs2r%Zconv2r5r6r&r'r)r*r+Zclient_versionr3r<�t)�	__class__)r$rrI2srQ

$




&




zConnection.__init__cCs&t|�}|j�|kr"tjj||�dS)N)�boolZget_autocommitr�
connectionr3)rRZonrrrr3�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&)rRr&rrr�cursor�szConnection.cursorcCs$t|t�rt|�}tjj||�dS)N)rA�	bytearrayrLrrX�query)rRr[rrrr[�s
zConnection.querycCs|j|�}|jrd|S|S)Ns_binary)r8rE)rRZbs�xrrr�_bytes_literal�s
zConnection._bytes_literalcCsddjt|j|��S)Ns(%s)�,)�join�map�literal)rRrUrrr�_tuple_literal�szConnection._tuple_literalcCs�t|t�r|j|j|j��}nzt|t�r4|j|�}ndt|t�rZtrN|j|�}q�|j|�}n>t|t	t
f�rt|j|�}n$|j||j
�}t|t�r�|j|j�}|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.
        )rArr8r9r:rZr]rLrrFrBrb�escaperK)rR�orrrrra�s

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

        This method is not used when autocommit=False (default).
        sBEGINN)r[)rRrrr�beginszConnection.begin�
warning_countcCs$|j�}|rt|j�d�SdSdS)zpReturn the number of warnings generated from the
            last query. This is derived from the info() method.rrN���)�inforrG)rRrhrrrrfszConnection.warning_countcsttj||�}|j�|krjytt|�j|�Wn<tk
rh|jdkrNtd��|j	d|�|j
�YnX||_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.r1rz server is too old to set charsetzSET NAMES %sN)r1r)�_charset_to_encodingrDrNrHrrO�AttributeErrorrMrr[�store_resultr:)rRr'Z
py_charset)rVrrrO's
zConnection.set_character_setcCs,|jdkrtd��|jd|�|j�dS)zNSet the connection sql_mode. See MySQL documentation for
        legal values.r1rz!server is too old to set sql_modezSET SESSION sql_mode='%s'N)r1r)rMrr[rk)rRr*rrrrP7s
zConnection.set_sql_modecCs.|jdkrfS|jd�|j�}|jd�}|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.r1rz
SHOW WARNINGSr)r1r)rMr[rkZ	fetch_row)rR�r�warningsrrr�
show_warnings?s


zConnection.show_warnings)N)!�__name__�
__module__�__qualname__�__doc__rZCursorrCrIr3rYr[r]rbrare�hasattrrrXrfrOrPrnrrrr
r	rrr
rr�
__classcell__rr)rVrr-s4,
		r)rr�re�sysZMySQLdbrrZMySQLdb.compatrrZMySQLdb._exceptionsrrrr	r
rrr
rrri�compilerrrXrrrrr�<module>s0