zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
U
£ý°d­-ã@s„dZddlZddlmZmZddlmZmZmZm    Z    m
Z
m Z m Z m Z mZmZddddd    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)
ÚWarningÚErrorÚInterfaceErrorÚ    DataErrorÚ DatabaseErrorÚOperationalErrorÚIntegrityErrorÚ InternalErrorÚNotSupportedErrorÚProgrammingErrorÚutf8Úcp1252Úkoi8_rÚkoi8_u)Zutf8mb4Zutf8mb3Úlatin1Zkoi8rZkoi8uz^(\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
    rN)Úre_numeric_partÚmatchÚintÚgroup)ÚsÚm©rúJd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\MySQLdb/connections.pyÚ numeric_part#s
 
rcs´eZdZdZejZ‡fdd„Zdd„Zdd„Z    dd    „Z
dd d „Z d d„Z dd„Z dd„Zdd„Zdd„Z‡fdd„Zdd„Zdd„ZeZeZeZeZeZeZeZeZeZeZ‡ZS)Ú
Connectionz MySQL Database Connection Objectcs\ddlm}m}ddlm}m}ddlm}| ¡}d|krJ|     d¡|d<d|kr`|     d¡|d<d    |krr|d    }    n|}    i}
|     
¡D]6\} } t | t ƒr°t | t ƒr°| d
d
…|
| <q‚| |
| <q‚|
|d    <|     d |j¡} | d d ¡}|     dd¡}|     dd ¡}|     dd¡|_| dd¡}||jO}|     dd¡}|r4||jO}||d<|     dd¡}tƒj||Ž| |_dd„|     
¡Dƒ|_tdd„| ¡ d¡d
d…Dƒƒ|_d|_|sª| ¡}| |¡|rÄ| |¡|r|j|j |j!|j"|j#|j$|j%fD]}||j&|<qêt'|j&|j(<||ƒ‰d‡fdd„    }||jt'<|j)|j*@|_+|j+rR|d
k    rR| ,|¡g|_-d
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 (deprecated)
        :param str database:    database to use
        :param str db:          alias of database (deprecated)
        :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 True.
 
        :param str charset:
            If supplied, the connection character set will be changed
            to this character set.
 
        :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 bool multi_statements:
            If True, enable multi statements for clients >= 4.1.
            Defaults to True.
 
        :param str ssl_mode:
            specify the security settings for connection to the server;
            see the MySQL documentation for more details
            (mysql_option(), MYSQL_OPT_SSL_MODE).
            Only one of 'DISABLED', 'PREFERRED', 'REQUIRED',
            'VERIFY_CA', 'VERIFY_IDENTITY' can be specified.
 
        :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ÚdbZdatabaseÚpasswdÚpasswordÚconvNÚ cursorclassÚcharsetÚÚ use_unicodeTÚsql_modeZ binary_prefixFÚ client_flagÚmulti_statementsÚ
autocommitcSs"i|]\}}t|ƒtk    r||“qSr)Útyper)Ú.0ÚkÚvrrrÚ
<dictcomp>»s z'Connection.__init__.<locals>.<dictcomp>cSsg|] }t|ƒ‘qSr)r)r0ÚnrrrÚ
<listcomp>¾sz'Connection.__init__.<locals>.<listcomp>Ú.éÚasciicsˆ | ˆj¡¡S©N)Ústring_literalÚencodeÚencoding)ÚuÚdummy©r#rrÚunicode_literalÛsz,Connection.__init__.<locals>.unicode_literal)N).ZMySQLdb.constantsrrZMySQLdb.convertersr r!Úweakrefr"ÚcopyÚpopÚitemsÚ
isinstancerÚlistÚdefault_cursorÚgetÚ_binary_prefixZ MULTI_RESULTSZMULTI_STATEMENTSÚsuperÚ__init__r'ÚencodersÚtupleZget_server_infoÚsplitÚ_server_versionr<Zcharacter_set_nameÚset_character_setÚ set_sql_modeÚSTRINGZ
VAR_STRINGZVARCHARZ    TINY_BLOBZ MEDIUM_BLOBZ    LONG_BLOBZBLOBÚ    converterÚstrZJSONZserver_capabilitiesZ TRANSACTIONSZ_transactionalr.Úmessages)ÚselfÚargsÚkwargsrrr r!r"Zkwargs2r&Zconv2r1r2r'r(r*r+r,r-r.Útr@©Ú    __class__r?rrK8sxY 
 
 
 
 ÿ
 
ù     
 
 
zConnection.__init__cCs|Sr9r©rVrrrÚ    __enter__æszConnection.__enter__cCs | ¡dSr9)Úclose)rVÚexc_typeÚ    exc_valueÚ    tracebackrrrÚ__exit__észConnection.__exit__cCs&t|ƒ}| ¡|kr"tj ||¡dSr9)ÚboolZget_autocommitrÚ
connectionr.)rVÚonrrrr.ì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')rVr'rrrÚcursorñszConnection.cursorcCs$t|tƒrt|ƒ}tj ||¡dSr9)rEÚ    bytearrayÚbytesrrdÚquery)rVrirrrriús
zConnection.querycCs.t|ttfƒst‚| |¡}|jr*d|S|S)Ns_binary)rErhrgÚAssertionErrorr:rI)rVÚbsÚxrrrÚ_bytes_literals
 
zConnection._bytes_literalcCsdd t|j|ƒ¡S)Ns(%s)ó,)ÚjoinÚmapÚliteral)rVrYrrrÚ_tuple_literalszConnection._tuple_literalcCsšt|tƒr| | |j¡¡}njt|tƒr4| |¡}nTt|tƒrJ| |¡}n>t|tt    fƒrd| 
|¡}n$|  ||j ¡}t|tƒrˆ| |j¡}t|tƒs–t ‚|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.
        )rErTr:r;r<rgrmrhrMrFrrÚescaperLrj)rVÚorrrrrq
s
 
 
 
 zConnection.literalcCs| d¡dS)ziExplicitly begin a connection.
 
        This method is not used when autocommit=False (default).
        sBEGINN)rir\rrrÚbegin!szConnection.begincstƒ |¡t ||¡|_dS)z,Set the connection character set to charset.N)rJrPÚ_charset_to_encodingrHr<)rVr(rZrrrP(s zConnection.set_character_setcCs,|jdkrtdƒ‚| d|¡| ¡dS)zNSet the connection sql_mode. See MySQL documentation for
        legal values.©érz!server is too old to set sql_modezSET SESSION sql_mode='%s'N)rOr riÚ store_result)rVr+rrrrQ-s
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.rwrz SHOW WARNINGSr)rOriryZ    fetch_row)rVÚrÚwarningsrrrÚ show_warnings5s 
 
 
zConnection.show_warnings)N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rÚCursorrGrKr]rbr.rfrirmrrrqrurPrQr|rrrr    rr
r r rr Ú __classcell__rrrZrr3s4 /
      r)r€Úrer)rrÚ _exceptionsrrrrr    r
r r r rrvÚcompilerrrdrrrrrÚ<module>s0û