Viewing File: /opt/hc_python/lib/python3.12/site-packages/mysql/connector/__pycache__/__init__.cpython-312.pyc

�

]��g?��J�dZ	ddlZddlmZdZddlmZddlm	Z	dd	l
mZmZm
Z
mZmZmZmZmZmZmZmZmZdd
lmZmZmZmZmZddlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.iZ/d
�Z0d�Z1d�Z2e2Z3ejhZ5ejlZ7gd�Z8y#e$rdZY��wxYw)z9
MySQL Connector/Python - MySQL driver written in Python
�N�)�CMySQLConnectionTF)�version)�MySQLConnection)�Error�Warning�InterfaceError�
DatabaseError�NotSupportedError�	DataError�IntegrityError�ProgrammingError�OperationalError�
InternalError�custom_error_exception�	PoolError)�	FieldFlag�	FieldType�CharacterSet�
RefreshOption�
ClientFlag)�Date�Time�	Timestamp�Binary�
DateFromTicks�TimestampFromTicks�
TimeFromTicks�STRING�BINARY�NUMBER�DATETIME�ROWID�apilevel�threadsafety�
paramstyle)�read_option_filesc��ddlm}m}m}	|d}|5|t
vr|di|��t
|<n=t
t
||�r*t
|j}d|vr|d|k7rtd��ddd�	t
|j�S#t$r|di|��}Y��wxYw#1swY�8xYw#t$rtdj|���wxYw)	z Return a pooled MySQL connectionr)�MySQLConnectionPool�generate_pool_name�CONNECTION_POOL_LOCK�	pool_name�	pool_sizez)Size can not be changed for active pools.Nz)Failed getting connection from pool '{0}'�)
�poolingr)r*r+�KeyError�_CONNECTION_POOLS�
isinstancer-r�get_connection�AttributeErrorr	�format)�kwargsr)r*r+r,�
check_sizes      �o/opt/hc_python/lib64/python3.12/site-packages/../../../lib/python3.12/site-packages/mysql/connector/__init__.py�_get_pooled_connectionr95s�����1��;�'�	�

��-�-�+>�+H��+H��i�(�
�)�)�4�6I�
J�*�9�5�?�?�J��v�%��{�+�z�9��!4�5�5�
�K� ��+�:�:�<�<��#�1�&�0��0�	�1��
�	���K��7�>�>�y�I�K�	K�K�s)�B	�AB �2B,�	B�B� B)�,$Cc	���|j�}	|d}|d=tgd��}|D]Z}t|j	��|z
}|s�"tdjt
|�dkDrdnddj|����|D]0}|j�}|j|�	td
i|��cStd	��#t$rtd��wxYw#t$rY�awxYw)a�Return a MySQL connection and try to failover if needed

    An InterfaceError is raise when no MySQL is available. ValueError is
    raised when the failover server configuration contains an illegal
    connection argument. Supported arguments are user, password, host, port,
    unix_socket and database. ValueError is also raised when the failover
    argument was not provided.

    Returns MySQLConnection instance.
    �failoverzfailover argument not provided)�user�password�host�port�unix_socket�databaser,r-z4Unsupported connection argument {0} in failover: {1}r�s�z, z-Could not failover: no MySQL server availabler.)�copyr0�
ValueError�set�keysr5�len�join�update�connectrr	)r6�configr;�support_cnx_args�server�diff�
new_configs       r8�_get_failover_connectionrQUs���[�[�]�F�;��*�%��	�z���	/�0��
���6�;�;�=�!�$4�4����F�M�M��t�9�q�=�C�b��I�I�d�O�%�&�
&�����[�[�]�
����&�!�	��(�Z�(�(�	��H�
I�I��5�;��9�:�:�;��,�	��	�s�C�-
C�C�	C*�)C*c���d|vrtdi|��}tdi|��Std|vd|vg�rtd��d|vrd|vrt	d��ddlm}||i|��Sd|vrt
di|��S	dd	lm}t|D�cgc]}||v��c}�rtdi|��S	|jd
d�}	|d
=tr
|st|i|��St!|i|��Scc}w#t$rY�DwxYw#t$rY�=wxYw)
a�Create or get a MySQL connection object

    In its simpliest form, Connect() will open a connection to a
    MySQL server and return a MySQLConnection object.

    When any connection pooling arguments are given, for example pool_name
    or pool_size, a pool is created or a previously one is used to return
    a PooledMySQLConnection.

    Returns MySQLConnection or PooledMySQLConnection.
    �option_files�fabricr;z-fabric and failover arguments can not be usedr,zR'pool_name' argument is not supported with  MySQL Fabric. Use 'pool_size' instead.r)rK)�
CNX_POOL_ARGS�use_pureTr.)r'rK�allr	r4rTrQ�	constantsrU�anyr9�	NameError�
setdefaultr0�	HAVE_CEXTrr)�argsr6rP�fabric_connectrU�keyrVs       r8rKrK�sB�����&�0��0�
��$��$�$�
�H���
�f� 4�5�6��L�M�M��6���&� � �"K�L�
L�5��t�.�v�.�.��V��'�1�&�1�1�
�,���7��#��v�
��7�8�)�3�F�3�3�9�� � ��T�2�H�
��:��
����0��0�0���/��/�/��#8���
��
���
��
�s6�(C�7C	�C�(C�	C�	C�C�	C)�(C))%r�Connectrrrrrrr\rrr	r
rrr
rrrrKr$r%r&rrrrrrrrrr r!r"r#r)9�__doc__�_mysql_connector�connection_cextrr\�ImportErrorrCr�
connectionr�errorsrrr	r
rrr
rrrrrrXrrrrr�dbapirrrrrrrrr r!r"r#r$r%r&�optionfilesr'r1r9rQrKr`�VERSION�__version_info__�VERSION_TEXT�__version__�__all__r.�r8�<module>ros���0���1��I��'�H�H�H�H���(�(�(�(�(�
+���K�@(J�V30�h���?�?���"�"�����u���I��s�
B�B"�!B"
Back to Directory File Manager