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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
U
£ý°dӆã
@sxdZddlZddlZddlZddlmZmZmZmZm    Z    m
Z
m Z m Z ddl mZddlmZddlmZmZmZmZmZddlmZdd    lmZmZmZmZmZdd
lm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(d Z)zXddl*Z*dd l*m+Z+m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9dZ)Wn6e:k
rbZ;ze:de;›dƒe;‚W5dZ;[;XYnXGdd„deƒZ<dS)z'Connection class using the C Extension.éN)ÚAnyÚDictÚListÚOptionalÚSequenceÚTupleÚTypeÚUnioné)Úversion)ÚMySQLConnectionAbstract)Ú CharacterSetÚ
ClientFlagÚ    FieldFlagÚ
ServerFlagÚ ShutdownType)ÚMySQLConverter)ÚInterfaceErrorÚ InternalErrorÚOperationalErrorÚProgrammingErrorÚget_mysql_exception)Ú MySQLProtocol)ÚCextEofPacketTypeÚCextResultTypeÚDescriptionTypeÚParamsSequenceOrDictTypeÚRowTypeÚStatsPacketTypeÚ
StrOrBytesF)ÚMySQLInterfaceErrorÚ MySQLPrepStmt) Ú CMySQLCursorÚCMySQLCursorBufferedÚCMySQLCursorBufferedDictÚCMySQLCursorBufferedNamedTupleÚCMySQLCursorBufferedRawÚCMySQLCursorDictÚCMySQLCursorNamedTupleÚCMySQLCursorPreparedÚCMySQLCursorPreparedDictÚCMySQLCursorPreparedNamedTupleÚCMySQLCursorPreparedRawÚCMySQLCursorRawTz2MySQL Connector/Python C Extension not available (ú)c s–eZdZdZeddœ‡fdd„ Zddœdd„Zddœd    d
„Zee    dœd d „ƒZ
e dd œdd„Z dŒe ddœdd„Zee dœdd„ƒZeje ddœdd„ƒZee dœdd„ƒZeje ddœdd„ƒZee    dœdd„ƒZddœdd„Zddœdd„ZeZe dœd d!„Ze dœd"d#„Zde e    e    dd'œd(d)„Ze dd*œd+d,„Zeeed-œd.d/„Zeee    dœd0d1„ƒZdŽee    e eee ee ee!e"eeee#fd2œd3d4„Z$de eee ee ee!e"eee#fd5œd6d7„Z%ee dœd8d9„Z&ddœd:d;„Z'ddœd<d=„Z(ddœd>d?„Z)e dd@œdAdB„Z*dee!e+dCœdDdE„Z,ee#dœdFdG„Z-e.e!dHœdIdJ„Z/e!eee0e#e+fdKœdLdM„Z1e!ddNœdOdP„Z2e!ddNœdQdR„Z3d‘eee e e ee0e#e+fdSœdTdU„Z4e4Z5d’ee ee ee ee6e7ee ee e7dVœdWdX„Z8ee    dœdYdZ„ƒZ9ee    dœd[d\„ƒZ:ee dœd]d^„ƒZ;ee dœd_d`„ƒZ<ee dœdadb„ƒZ=e>e0e?e.e@e e.ffdcœddde„ZAddœdfdg„ZBd“e e e e    e e e ee ee ddjœ
dkdl„ZCe dœdmdn„ZDe    ee#doœdpdq„ZEddœdrds„ZFd”ee    ddtœdudv„ZGeHdœdwdx„ZIe    ddyœdzd{„ZJedœd|d}„ZKedœd~d„ZLeed€œdd‚„ZMeeeedƒœd„d…„ZNd•e dd†œd‡dˆ„ZOd–ee@e efee@e efdd‰œdŠd‹„ZP‡ZQS)—ÚCMySQLConnectionz6Class initiating a MySQL Connection using Connector/C.N)ÚkwargsÚreturnc s’ts tdƒ‚d|_g|_tj tj tj t    j
¡¡ddd¡|_ t   ¡dkrntj |j ¡sntj d¡rhdnd|_ d|_tƒ ¡|rŽ|jf|ŽdS)    ZInitializationz0MySQL Connector/Python C Extension not availableNZmysqlÚvendorZpluginÚLinuxz/usr/lib64/mysql/pluginz/usr/lib/mysql/plugin)Ú HAVE_CMYSQLÚ RuntimeErrorÚ_cmysqlÚ_columnsÚosÚpathÚjoinÚdirnameÚabspathÚ_mysql_connectorÚ__file__Ú _plugin_dirÚplatformÚsystemÚexistsÚ    converterÚsuperÚ__init__Úconnect)Úselfr0©Ú    __class__©úVd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\mysql/connector/connection_cext.pyrE]s*þü 
ÿý
zCMySQLConnection.__init__)r1c
CsZtj d¡}|ddkrd}nd}|j d|d dd    „tjdd
…Dƒ¡t ¡d œ¡d S) z!Add default connection attributesú rZGPLv2zGPL-2.0Z
Commercialzmysql-connector-pythonÚ.cSsg|] }t|ƒ‘qSrJ)Ústr)Ú.0ÚxrJrJrKÚ
<listcomp>†sz<CMySQLConnection._add_default_conn_attrs.<locals>.<listcomp>é)Z_connector_nameZ_connector_licenseZ_connector_versionZ _source_hostN)    r ÚLICENSEÚsplitÚ _conn_attrsÚupdater:ÚVERSIONÚsocketÚ gethostname)rGZlicense_chunksZclient_licenserJrJrKÚ_add_default_conn_attrszs  üÿz(CMySQLConnection._add_default_conn_attrsc    CsR|j ¡|j ¡|j ¡dddd|j ¡dœ|_| |jd¡|_t     |j¡dS)z<Gather information of the MySQL server before authenticationN)ÚprotocolÚserver_version_originalZserver_threadidÚcharsetÚ server_statusÚ auth_pluginZ    auth_dataZ capabilitiesr\)
r6Zget_proto_infoZget_server_infoÚ    thread_idZst_server_capabilitiesZ
_handshakeZ_check_server_versionZ_server_versionr Zset_mysql_version©rGrJrJrKÚ _do_handshake‹sø ÿzCMySQLConnection._do_handshakecCs
|j ¡S)z6Returns the server status attribute of MYSQL structure)r6Zst_server_statusrarJrJrKÚ_server_statusszCMySQLConnection._server_status)r9r1cCs|jr|j |¡dS)zJset local_infile_in_path
 
        Set allow_local_infile_in_path.
        N)r6Z!set_load_data_local_infile_option)rGr9rJrJrKÚset_allow_local_infile_in_path¢sz/CMySQLConnection.set_allow_local_infile_in_pathT)Úvaluer1cCs.||_|jr|j |¡|jr*|j |¡dS)zuToggle unicode mode
 
        Set whether we return string fields as unicode or not.
        Default is True.
        N)Ú _use_unicoder6Ú use_unicoderCÚ set_unicode©rGrerJrJrKrh«s
 zCMySQLConnection.set_unicodecCs| d¡d}|dkS)z#Get whether autocommit is on or offzSELECT @@session.autocommitrr
©Ú
info_queryrirJrJrKÚ
autocommit·szCMySQLConnection.autocommitc
CsTz|j |¡||_Wn8tk
rN}zt|j|j|jd|‚W5d}~XYnXdS)zToggle autocommit©ÚmsgÚerrnoÚsqlstateN)r6rlZ _autocommitr rrnrorp©rGreÚerrrJrJrKrl½s 
ÿþcCs| d¡dS)zGet the current databasezSELECT DATABASE()rrjrarJrJrKÚdatabaseÈszCMySQLConnection.databasec
CsNz|j |¡Wn8tk
rH}zt|j|j|jd|‚W5d}~XYnXdS)zSet the current databasermN©r6Z    select_dbr rrnrorprqrJrJrKrsÍsÿþcCs |jtj@S)z'MySQL session has started a transaction)rcrZSTATUS_IN_TRANSrarJrJrKÚin_transaction×szCMySQLConnection.in_transactioncCst |j¡d}tj|j|j||jp&d|j|j    |j
d|_ |  t j¡sLi|_|j|j|j|j|j|j|j|j|j|j|  t j¡d|j|j|j|j|j|jdœ}|j  !d¡}|dk    rÈ|j"ddd #|¡}|j  !d¡dk    rú|j  !d¡d}|j  !d¡d    }nd}d}|dk    r d
|kr |s d }|j$s|| %|j  !d ¡|j  !d ¡|j  !d¡||||j  !d¡p`d|j  !d¡ppd|j$dœ    ¡t&j'dkrœ|j(dkrœd|d<z.|j j)f|Ž|j*|j _+|j,rÈ|j*|j,_-Wn:t.k
r}zt/|j0|j1|j2d|‚W5d}~XYnX| 3¡dS)Nr)ÚbufferedÚrawÚ charset_nameZconnection_timeoutrgr_Z
plugin_dirT)ÚhostÚuserÚpasswordÚ    password1Ú    password2Ú    password3rsÚportZ client_flagsZ unix_socketÚcompressÚ ssl_disabledZ
conn_attrsZ local_infileZload_data_local_dirÚoci_config_fileÚoci_config_profileZ fido_callbackÚ tls_versions)Úreverseú,Útls_ciphersuitesr
zTLSv1.3ZTLS_AES_256_GCM_SHA384ÚcaÚcertÚkeyZ verify_certFZverify_identity)    Zssl_caZssl_certZssl_keyZssl_cipher_suitesr„Ztls_cipher_suitesZssl_verify_certZssl_verify_identityrÚntZMySQLKerberosAuthPluginZuse_kerberos_gssapirm)4r Úget_infoÚ _charset_idr=ZMySQLÚ    _bufferedÚ_rawZ_connection_timeoutrfZ _auth_pluginr?r6Zisset_client_flagrZ CONNECT_ARGSrUÚ_hostÚ_userÚ    _passwordÚ
_password1Ú
_password2Ú
_password3Ú    _databaseÚ_portZ _client_flagsÚ _unix_socketZCOMPRESSZ_allow_local_infileZ_allow_local_infile_in_pathÚ_oci_config_fileÚ_oci_config_profileZ_fido_callbackÚ_sslÚgetÚsortr:Z _ssl_disabledrVr8ÚnameZ_auth_plugin_classrFÚ_converter_str_fallbackÚconverter_str_fallbackrCZ str_fallbackr rrnrorprb)rGrxZ
cnx_kwargsr„Zssl_ciphersuitesr‡rrrJrJrKÚ_open_connectionÜs˜ù
 
î  
ÿþý
 
 
÷ÿ
ÿþz!CMySQLConnection._open_connectionc
CsZ|jrVz| ¡|j ¡Wn8tk
rT}zt|j|j|jd|‚W5d}~XYnXdS)z Disconnect from the MySQL serverrmN)r6Ú free_resultÚcloser rrnrorp)rGrrrJrJrKr£.sÿþzCMySQLConnection.closecCs |j ¡ S)z8Return True if the connection to MySQL Server is closed.)r6Ú    connectedrarJrJrKÚ    is_closed;szCMySQLConnection.is_closedcCs|jr| ¡|j ¡SdS)z;Reports whether the connection to MySQL Server is availableF)r6Úhandle_unread_resultÚpingrarJrJrKÚ is_connected?s
zCMySQLConnection.is_connectedFr
r)Ú    reconnectÚattemptsÚdelayr1cCsT| ¡z|j ¡}Wntk
r*Yn
X|r4dS|rH|j||dntdƒ‚dS)aîCheck availability of the MySQL server
 
        When reconnect is set to True, one or more attempts are made to try
        to reconnect to the MySQL server using the reconnect()-method.
 
        delay is the number of seconds to wait between each retry.
 
        When the connection is not available, an InterfaceError is raised. Use
        the is_connected()-method if you just want to check the connection
        without raising an error.
 
        Raises InterfaceError on errors.
        N)rªr«z$Connection to MySQL is not available)r¦r6r§ÚAttributeErrorr©r)rGr©rªr«r¤rJrJrKr§GszCMySQLConnection.ping)r]r1cCs|j |¡dS)z;Sets the default character set name for current connection.N)r6Zset_character_set)rGr]rJrJrKÚset_character_set_namedsz'CMySQLConnection.set_character_set_name)Úqueryr1c
CsŠd}zH|j |¡|jjr@|j ¡}|j ¡r@|j ¡tdƒ‚|j ¡Wn8tk
r„}zt|j|j    |j
d|‚W5d}~XYnX|S)z%Send a query which only returns 1 rowrJz'Query should not return more than 1 rowrmN) r6r®Úhave_result_setÚ    fetch_rowr¢rr rrnrorp)rGr®Z    first_rowrrrJrJrKrkhs$ 
 
 
ÿþzCMySQLConnection.info_querycCs&z |j ¡WStk
r YnXdS)zMySQL connection IDN)r6r`r rarJrJrKÚ connection_idzs
 zCMySQLConnection.connection_id)ÚcountÚbinaryÚcolumnsrwÚ    prep_stmtr1c
Cs˜|r
|jn|j}|jr|s"tdƒ‚|dkr0|j}g}|dk    rL|dkrLtdƒ‚d}zà|r\|jn|jj}    |jrv|j d¡|    ƒ}
|
rö|jsÎ|jrÎt    |
ƒ}
t
|
ƒD](\} } |sœ|j  |j | |
| ¡|
| <qœt |
ƒ}
| |
¡|d7}|rî||krîqö|    ƒ}
q||
s*| |¡d} |r | ¡d|_n| ¡nd} Wn^tk
rŽ}z>|r`| ¡tt|ƒƒ|‚| ¡t|j|j|jd    |‚W5d}~XYnX|| fS)
z8Get all or a subset of rows returned by the MySQL serverzNo result set availableNrz$count should be 1 or higher, or NoneTr
ÚeofFrm)r¯Ú unread_resultr6rrr¬r°rCrwÚlistÚ    enumerateZ    to_pythonr7ÚtupleÚappendÚfetch_eof_columnsr¢Ú_unread_resultr rrNrrnrorp)rGr²r³r´rwrµr·ÚrowsÚcounterr°ÚrowÚiÚ_Ú_eofrrrJrJrKÚget_rows„s`    
 
 ÿ
ÿþzCMySQLConnection.get_rows)r³r´rwrµr1cCsPz4|jd||||d\}}|r,|d|fWSd|fWStk
rJYdSXdS)z.Get the next rows returned by the MySQL serverr
)r²r³r´rwrµrN)NN)rÄÚ
IndexError)rGr³r´rwrµr¾r¶rJrJrKÚget_rowÃsû
 
zCMySQLConnection.get_rowcCs|jr|j ¡|j ¡SdS)zReads the next resultN)r6Úconsume_resultÚ next_resultrarJrJrKrÈÚs
 
zCMySQLConnection.next_resultcCs|jr|j ¡dS)zFrees the resultN)r6r¢rarJrJrKr¢ászCMySQLConnection.free_resultcCs|jr| ¡|j ¡dS)zCommit current transactionN)r6r¦ÚcommitrarJrJrKrÉæszCMySQLConnection.commitcCs|jr|j ¡|j ¡dS)zRollback current transactionN)r6rÇÚrollbackrarJrJrKrÊìs
zCMySQLConnection.rollback)rsr1c
CsNz|j |¡Wn8tk
rH}zt|j|j|jd|‚W5d}~XYnXdS)zChange the current databasermNrt)rGrsrrrJrJrKÚ cmd_init_dbòsÿþzCMySQLConnection.cmd_init_db)rµr1cCs¨|r
|jn|jj}|stdƒ‚|r*| ¡n|j ¡}g|_|D]N}|j |dt|dƒddddt|dƒtj@t|dƒt|dƒf    ¡q>|j    |j 
¡dœ|jdœS)    z Fetch EOF and column informationú No result setééNé    é)Z status_flagÚ warning_count)r¶r´) r¯r6rZ fetch_fieldsr7r»ÚintrZNOT_NULLrcÚst_warning_count)rGrµr¯ÚfieldsÚcolrJrJrKr¼ûs0ÿ
 
 
÷ÿþûz"CMySQLConnection.fetch_eof_columnscCs4|jr0|j ¡|j ¡|j ¡|j ¡|jdœSdS)z Fetch EOF and status information)rÑZ field_countÚ    insert_idÚ affected_rowsr^N)r6rÓZst_field_countrÖr×rcrarJrJrKÚfetch_eof_statussûz!CMySQLConnection.fetch_eof_status)Ú    statementr1c
Cs^|jstdƒ‚z|j |¡}|j|_|WStk
rX}ztt|ƒƒ|‚W5d}~XYnXdS)zPrepares the SQL statementúMySQL Connection not availableN)r6rZ stmt_preparerŸr r rrN)rGrÙZstmtrrrJrJrKÚcmd_stmt_prepare+s z!CMySQLConnection.cmd_stmt_prepare)Ú statement_idÚargsr1c
Gsjz|j|ŽWn0tk
r>}ztt|ƒƒ|‚W5d}~XYnXg|_|jsZd|_| ¡Sd|_| |¡S)zExecutes the prepared statementNFT)    Z stmt_executer rrNr7r¯r½rØr¼)rGrÜrÝrrrJrJrKÚcmd_stmt_execute7s z!CMySQLConnection.cmd_stmt_execute)rÜr1cCs|jrtdƒ‚| ¡dS)zCloses the prepared statementúUnread result foundN)r½rZ
stmt_close©rGrÜrJrJrKÚcmd_stmt_closeIszCMySQLConnection.cmd_stmt_closecCs|jrtdƒ‚| ¡dS)zResets the prepared statementrßN)r½rZ
stmt_resetràrJrJrKÚcmd_stmt_resetOszCMySQLConnection.cmd_stmt_reset)r®rwrvÚ raw_as_stringr1c
Csî| ¡|dkr|j}z0t|tƒs,| d¡}|jj|||||jdWnˆtk
r~}zt    |j
|j |j d|‚W5d}~XYnRt k
rÎ}z4|jrš|jn|j›d|j›}td|dfd|‚W5d}~XYnXg|_|jjsæ| ¡S| ¡S)    z Send a query to the MySQL serverNzutf-8)rwrvrãZ query_attrs)rnrpú:izConnection not available.)roÚvalues)r¦rÚ
isinstanceÚbytesÚencoder6r®Z _query_attrsr rrornrpr¬r˜rr—rr7r¯rØr¼)rGr®rwrvrãrrÚaddrrJrJrKÚ    cmd_queryUsD
 
û
ÿþÿÿþzCMySQLConnection.cmd_query)rvrwÚpreparedÚ cursor_classÚ
dictionaryÚ named_tupler1c s| |¡| ¡stdƒ‚|dk    r<t|tƒs4tdƒ‚||ƒS|pD|j}|pN|j}d‰|dkrdˆdO‰|dkrtˆdO‰|dkr„ˆdO‰|dkr”ˆd    O‰|dkr¤ˆd
O‰ttt    t
t t t tttttd œ }z|ˆ|ƒWStk
rd ‰td d ‡‡fdd„tdƒDƒ¡ƒd‚YnXdS)aÅInstantiates and returns a cursor using C Extension
 
        By default, CMySQLCursor is returned. Depending on the options
        while connecting, a buffered and/or raw cursor is instantiated
        instead. Also depending upon the cursor options, rows can be
        returned as dictionary or named tuple.
 
        Dictionary and namedtuple based cursors are available with buffered
        output but not raw.
 
        It is possible to also give a custom cursor through the
        cursor_class parameter, but it needs to be a subclass of
        mysql.connector.cursor_cext.CMySQLCursor.
 
        Raises ProgrammingError when cursor_class is not a subclass of
        CursorBase. Raises ValueError when cursor is not available.
 
        Returns instance of CMySQLCursor or subclass.
 
        :param buffered: Return a buffering cursor
        :param raw: Return a raw cursor
        :param prepared: Return a cursor which uses prepared statements
        :param cursor_class: Use a custom cursor class
        :param dictionary: Rows are returned as dictionary
        :param named_tuple: Rows are returned as named tuple
        :return: Subclass of CMySQLCursor
        :rtype: CMySQLCursor or subclass
        úMySQL Connection not available.Nz=Cursor class needs be to subclass of cursor_cext.CMySQLCursorrTr
érÍrÎé) rr
rðrRrÍérÎrÏrñééé)rvrwrírîrëz*Cursor not available with given criteria: z, cs$g|]}ˆd|>@dkrˆ|‘qS)r
rrJ)rOrÁ©rÝZ cursor_typerJrKrQÑsz+CMySQLConnection.cursor.<locals>.<listcomp>rò)r¦r¨rÚ
issubclassr"rrŽrr#r-r&r'r$r(r%r)r,r*r+ÚKeyErrorÚ
ValueErrorr:Úrange)rGrvrwrërìrírîÚtypesrJrörKÚcursors\%
 
ÿ
 
ôÿÿýzCMySQLConnection.cursorcCs|jjstdƒ‚|j ¡S)z,Returns number of rows of current result setrÌ)r6r¯rÚnum_rowsrarJrJrKrýÔszCMySQLConnection.num_rowscCs|js
dS|j ¡S)zReturns number of warningsr)r6rÑrarJrJrKrÑÜszCMySQLConnection.warning_countcCs|js
dS|jjS)z"Check if a result set is availableF)r6r¯rarJrJrKÚresult_set_availableäsz%CMySQLConnection.result_set_availablecCs|jS)z)Check if there are unread results or rows)rþrarJrJrKr·ìszCMySQLConnection.unread_resultcCs
|j ¡S)zCheck if there are more results)r6Ú more_resultsrarJrJrKrÿñszCMySQLConnection.more_results)Úparamsr1csÎg}t|ttfƒr:ˆjr,‡fdd„|Dƒ}qʈjj|Ž}nt|tƒr®i}ˆjr†| ¡D],\}}ˆj ˆj     ˆj 
|¡ˆj ¡¡||<qVqÊ| ¡D]\}}ˆj |¡d||<qŽnt dt |ƒj›d|›dƒ‚|S)z¬Prepare parameters for statements
 
        This method is use by cursors to prepared parameters found in the
        list (or tuple) params.
 
        Returns dict.
        c    s,g|]$}ˆj ˆj ˆj |¡ˆj¡¡‘qSrJ)rCÚquoteÚescapeÚto_mysqlÚ    _sql_mode)rOrerarJrKrQsû
ÿÿz6CMySQLConnection.prepare_for_mysql.<locals>.<listcomp>rzCould not process parameters: ú(z)), it must be of type list, tuple or dict)rær¸rºrCr6Zconvert_to_mysqlÚdictÚitemsrrrrrÚtypeÚ__name__)rGrÚresultrŠrerJrarKÚprepare_for_mysqlös.
 
ú    
 
ÿÿ ÿz"CMySQLConnection.prepare_for_mysqlcCs|j ¡dS)zlConsume the current result
 
        This method consume the result by reading (consuming) all rows.
        N)r6rÇrarJrJrKÚconsume_results!sz CMySQLConnection.consume_resultsÚé-)
Úusernamer{rsr]r|r}r~r‚rƒr1c
 
Csjz|j ||||||||    ¡Wn8tk
rV}
zt|
j|
j|
jd|
‚W5d}
~
XYnX||_| ¡dS)z!Change the current logged in userrmN)    r6Z change_userr rrnrorprÚ_post_connection) rGrr{rsr]r|r}r~r‚rƒrrrJrJrKÚcmd_change_user(s* ø ÿþz CMySQLConnection.cmd_change_usercCs|j ¡}|r| ¡|S)zÖResets the session state without re-authenticating
 
        Reset command only works on MySQL server 5.7.3 or later.
        The result is True for a successful reset otherwise False.
 
        Returns bool
        )r6Zreset_connectionr)rGÚresrJrJrKÚcmd_reset_connectionIs
z%CMySQLConnection.cmd_reset_connection)Úoptionsr1c
CsZz| ¡|j |¡Wn8tk
rP}zt|j|j|jd|‚W5d}~XYnX| ¡S)z,Send the Refresh command to the MySQL serverrmN)    r¦r6Zrefreshr rrnrorprØ)rGrrrrJrJrKÚ cmd_refreshVsÿþzCMySQLConnection.cmd_refreshcCs | ¡dS)z,Close the current connection with the serverN)r£rarJrJrKÚcmd_quitbszCMySQLConnection.cmd_quit)Ú shutdown_typer1c
Cs†|jstdƒ‚|r*t |¡s$tdƒ‚|}ntj}z|j |¡Wn8tk
rx}zt|j    |j
|j d|‚W5d}~XYnX|  ¡dS)zShut down the MySQL ServerrÚzInvalid shutdown typermN) r6rrrŒrZSHUTDOWN_DEFAULTÚshutdownr rrnrorpr£)rGrÚlevelrrrJrJrKÚ cmd_shutdownfs$
ÿþzCMySQLConnection.cmd_shutdownc
Csf| ¡z|j ¡}tƒj|ddWSttfk
r`}zt|j|j    |j
d|‚W5d}~XYnXdS)z'Return statistics from the MySQL serverF)Z with_headerrmN) r¦r6ÚstatrZparse_statisticsr rrrnrorp)rGrrrrJrJrKÚcmd_statisticszs
ÿþzCMySQLConnection.cmd_statistics)Ú    mysql_pidr1cCs&t|tƒstdƒ‚| d|›¡dS)zKill a MySQL processzMySQL PID must be intzKILL N)rærÒrùrk)rGrrJrJrKÚcmd_process_kill†s
z!CMySQLConnection.cmd_process_killcCst‚dS)zSend the DEBUG commandN©ÚNotImplementedErrorrarJrJrKÚ    cmd_debugŒszCMySQLConnection.cmd_debugcCst‚dS)zSend the PING commandNrrarJrJrKÚcmd_pingszCMySQLConnection.cmd_ping)Ú
statementsr1cCst‚dS)z/Send one or more statements to the MySQL serverNr)rGr#rJrJrKÚcmd_query_iter”szCMySQLConnection.cmd_query_iter)rÜÚparam_idÚdatar1cCst‚dS)zSend data for a columnNr)rGrÜr%r&rJrJrKÚcmd_stmt_send_long_data˜sz(CMySQLConnection.cmd_stmt_send_long_data)rër1cCs4|dkr|jn|j}|jr$| ¡n |r0tdƒ‚dS)z'Check whether there is an unread resultTrßN)r½r·Zcan_consume_resultsr r)rGrër·rJrJrKr¦žs
 
z%CMySQLConnection.handle_unread_result)Úuser_variablesÚsession_variablesr1c CsÚ| ¡stdƒ‚| ¡sfz0| |j|j|j|j|j|j    |j
|j |j ¡    Wnt k
rd| ¡YnX|sn|rÖ| ¡}|r¢| ¡D]\}}| d|›d|f¡q‚|rÎ| ¡D]\}}| d|›d|f¡q®| ¡dS)aÇClears the current active session
 
        This method resets the session state, if the MySQL server is 5.7.3
        or later active session will be reset without re-authenticating.
        For other server versions session will be reset by re-authenticating.
 
        It is possible to provide a sequence of variables and their values to
        be set after clearing the session. This is possible for both user
        defined variables and session variables.
        This method takes two arguments user_variables and session_variables
        which are dictionaries.
 
        Raises OperationalError if not connected, InternalError if there are
        unread results and InterfaceError on errors.
        rïzSET @`z` = %sz SET SESSION `N)r¨rrrr‘r’r–rr“r”r•r™ršrr©rürÚexecuter£)rGr(r)ÚcurrŠrerJrJrKÚ reset_session¦s4÷ zCMySQLConnection.reset_session)T)Fr
r)NFNNN)FNNN)N)NFF)NNNNNN)    r r r rr r r NN)N)F)NN)Rr    Ú
__module__Ú __qualname__Ú__doc__rrErZrbÚpropertyrÒrcrNrdÚboolrhrlÚsetterrsrur¡r£Z
disconnectr¥r¨r§r­rrrrkr±rrr!rrrÄrÆrÈr¢rÉrÊrËrr¼rØrçrÛr    rÞrárârêZ_execute_queryrr"rürýrÑrþr·rÿrrrr r rrrrrrrrr!r"r$r'r¦r,Ú __classcell__rJrJrHrKr/Zs2     
    R  ú
ù Aû
ú 
ÿþ #  þ     ûú (ù
ø Uþ +    öõ !   þ 
ýür/)=r/r8r@rXÚtypingrrrrrrrr    r r Z    abstractsr Ú    constantsr rrrrÚ
conversionrÚerrorsrrrrrr[rrûrrrrrrrr4r=r r!Z cursor_cextr"r#r$r%r&r'r(r)r*r+r,r-Ú ImportErrorÚexcr/rJrJrJrKÚ<module>s0(    $
8
ÿþ