B
XG9 @ s d Z ddlZddlZddlmZ ddlmZmZ ddlm Z m
Z
mZmZm
Z
mZmZmZmZmZ ddlZesejdd dk rdd ed
D Zdd Znd
d Zdd ZedZdd ZG dd dejZdS )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)unicodePY2)
WarningErrorInterfaceError DataError
DatabaseErrorOperationalErrorIntegrityError
InternalErrorNotSupportedErrorProgrammingError ) c C s( g | ] }|d k rt |n
t |d qS ) i )chr).0i r F/opt/alt/python37/lib64/python3.7/site-packages/MySQLdb/connections.py
<listcomp> s r c C s | dtS )Nlatin1)decode translate_surrogateescape_table)sr r r _fast_surrogateescape s r c C s | ddS )Nasciisurrogateescape)r )r r r r r s c C sV ||f}|r|j | n| j | ~~ t|tr8||dk rJ||nt|dS )a*
If cursor is not None, (errorclass, errorvalue) is appended to
cursor.messages; otherwise it is appended to
connection.messages. Then errorclass is raised with errorvalue as
the value.
You can override this with your own error handler by assigning it
to the instance.
N)messagesappend
isinstance
BaseException Exception)
connectioncursorZ
errorclassZ
errorvalueerrorr r r defaulterrorhandler s
r* z^(\d+)c C s t | }|rt|dS dS )zReturns the leading numeric part of a string.
>>> numeric_part("20-alpha")
20
>>> numeric_part("foo")
>>> numeric_part("16b")
16
N)re_numeric_partmatchintgroup)r mr r r numeric_part; s
r1 c s e Zd ZdZejZdZ fddZdd Z dddZ
d d
Zdd Zd
d Z
dd Zdd Zeejdspdd Z fddZdd Zdd ZeZeZeZeZeZeZeZeZeZe Z e!Z"