gh ddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z ddl m Z mZmZmZmZmZddlmZddlmZddlmZdd lmZmZmZmZmZmZdd lmZm Z  ddl!Z!d Z"n#e#$rdZ!d Z"YnwxYw ddl$Z$e$j%Z&[$n#e#e'f$rdZ&YnwxYwd Z(ej)ej*ej+ej,ej-ej.ej/ej0ej1h Z2d Z3dZ4dZ5dZ6GddZ7GddZ8GddZ9dS)N)_auth)charset_by_name charset_by_id)CLIENTCOMMANDCRER FIELD_TYPE SERVER_STATUS) converters)Cursor)Parser) dump_packet MysqlPacketFieldDescriptorPacketOKPacketWrapperEOFPacketWrapperLoadLocalPacketWrapper)errVERSION_STRINGTFutf8mb4ic<tjd|ddS)NZ>e9j?Z?e9j@Z@e9jAZAe9jBZBe9jCZCdS): Connectiona Representation of a socket with a mysql server. The proper way to get an instance of this class is to call connect(). Establish a connection to the MySQL database. Accepts several arguments: :param host: Host where the database server is located. :param user: Username to log in as. :param password: Password to use. :param database: Database to use, None to not use a particular one. :param port: MySQL port to use, default is usually OK. (default: 3306) :param bind_address: When the client has multiple network interfaces, specify the interface from which to connect to the host. Argument can be a hostname or an IP address. :param unix_socket: Use a unix socket rather than TCP/IP. :param read_timeout: The timeout for reading from the connection in seconds. (default: None - no timeout) :param write_timeout: The timeout for writing to the connection in seconds. (default: None - no timeout) :param str charset: Charset to use. :param str collation: Collation name to use. :param sql_mode: Default SQL_MODE to use. :param read_default_file: Specifies my.cnf file to read these parameters from under the [client] section. :param conv: Conversion dictionary to use instead of the default one. This is used to provide custom marshalling and unmarshalling of types. See converters. :param use_unicode: Whether or not to default to unicode strings. This option defaults to true. :param client_flag: Custom flags to send to MySQL. Find potential values in constants.CLIENT. :param cursorclass: Custom cursor class to use. :param init_command: Initial SQL statement to run when connection is established. :param connect_timeout: The timeout for connecting to the database in seconds. (default: 10, min: 1, max: 31536000) :param ssl: A dict of arguments similar to mysql_ssl_set()'s parameters or an ssl.SSLContext. :param ssl_ca: Path to the file that contains a PEM-formatted CA certificate. :param ssl_cert: Path to the file that contains a PEM-formatted client certificate. :param ssl_disabled: A boolean value that disables usage of TLS. :param ssl_key: Path to the file that contains a PEM-formatted private key for the client certificate. :param ssl_key_password: The password for the client certificate private key. :param ssl_verify_cert: Set to true to check the server certificate's validity. :param ssl_verify_identity: Set to true to check the server's identity. :param read_default_group: Group to read from in the configuration file. :param autocommit: Autocommit mode. None means use server default. (default: False) :param local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False) :param max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB) Only used to limit size of "LOAD LOCAL INFILE" data packet smaller than default (16KB). :param defer_connect: Don't explicitly connect on construction - wait for connect call. (default: False) :param auth_plugin_map: A dict of plugin names to a class that processes that plugin. The class will take the Connection object as the argument to the constructor. The class needs an authenticate method taking an authentication packet as an argument. For the dialog plugin, a prompt(echo, prompt) method can be used (if no authenticate method) for returning a string from the user. (experimental) :param server_public_key: SHA256 authentication plugin public key value. (default: None) :param binary_prefix: Add _binary prefix on bytes and bytearray. (default: False) :param compress: Not supported. :param named_pipe: Not supported. :param db: **DEPRECATED** Alias for database. :param passwd: **DEPRECATED** Alias for password. See `Connection `_ in the specification. NFrT r&)(userpasswordhostdatabase unix_socketportcharset collationsql_moderead_default_fileconv use_unicode client_flag cursorclass init_commandconnect_timeoutread_default_group autocommit local_infilemax_allowed_packet defer_connectauth_plugin_map read_timeout write_timeout bind_address binary_prefix program_nameserver_public_keysslssl_cassl_cert ssl_disabledssl_keyssl_key_passwordssl_verify_certssl_verify_identitycompress named_pipepasswddbc(,|(||(}|'|s|'}|%s|&rtdt||_|jr| tjz} r&| s$t jdrd} nd} | rsdt,, tj | ,fd})|)d|}|)d|}|)d |}|)d |}|)d |}t|)d |}|)d |}|)d|}|si}t|tr)dD]&}*|)d|*z|j|*}+|+r|+||*<'d|_| s~|s|s|!s|#s|$r,|t|$|#|#ndd}|||d<|!|!|d<|"|"|d<|rFt$stdd|_| tjz} |||_|pd|_|pd|_t1|jturt3d|pt4|_|pd|_t|jt:r|jd|_||_||_ ||_!d|cxkrdksnt3d|pd|_"||dkrt3d||_#||dkrt3d ||_$|ptJ|_&||_'| |_(tS|j&j*|_*| tj+z} |jr| tj,z} | |_-||_.d|_/d|_0d!|_1||_2| tfj4} d"| 5D|_6d#| 5D|_7| |_8||_9||_:|pi|_;||_<||_=d$t|t;tj?d%|_@|r ||j@d&<|r d|_AdS|BdS)'Nz3compress and named_pipe arguments are not supportedwinz c:\my.iniz /etc/my.cnfclientc^|r|S |S#t$r|cYSwxYwN)get Exception)keyargcfgrBs r_configz$Connection.__init__.._configsNJ77#5s;;; JJJs  ,,r2r3r4r5socketr7z bind-addresszdefault-character-set)cacapathcertrar3cipherzssl-F)rfcheck_hostname verify_moderhrazssl module not foundT localhosti zport should be of type intr!latin1ri3z+connect_timeout should be >0 and <=31536000zread_timeout should be > 0zwrite_timeout should be > 0z Not connectedcFi|]\}}t|tu||Stypeint.0kvs r z'Connection.__init__..Ts.OOO&1aDGG3.Us)KKK&1aDGGsNNANNNr!pymysql) _client_name_client_version_pidrL)CNotImplementedErrorbool _local_infiler LOCAL_FILESsysplatform startswithrreadospath expanduserrr isinstancedictr_rN SSL_ENABLEDSSL_create_ssl_ctxctxr4r7rqr* DEFAULT_USERr2r3strencoderYr6rJrA _read_timeout_write_timeoutDEFAULT_CHARSETr8r9r=rencoding CAPABILITIESCONNECT_WITH_DBr>r?_result_affected_rows host_infoautocommit_moder conversionsitemsencodersdecodersr:r@rE_auth_plugin_map_binary_prefixrMrgetpid_connect_attrs_sockconnect)-selfr2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrdravaluercs- ` @r__init__zConnection.__init__sVX >h.H  h  H  z %E ",//   . 6- -K  2&7 2|&&u-- 2$0!!$1!  )% .%-"((C HHRW''(9:: ; ; ;      764((Dwz844H764((Dwz844H!'(K88Kwwvt,,--D"7><@@Lg5w??G #t$$ )P))C#GFSL'#'#,,??E)#(C 5 7 7W 7 7CV 7 &*+>&?&?&2$3? '"*CK&!(CJ#/&6C O 5"F-.DEEEvz) //44'K LD  ??# % %9:: :(L  C dmS ) ) ; M00::DM&(O////x////JKK K.6$  # (9(99:: :)  $!););:;; ;+1/ "&' 55> v** 7 2 61 1K&& ( * <)DPODJJLLOOO KKDJJLLKKK   ("4 / 52+!2&- $$    ?2>D  /  DJJJ LLNNNNNr!c|Sr^rors r __enter__zConnection.__enter__ks r!c0~|dSr^)close)rexc_infos r__exit__zConnection.__exit__ns  r!c0t|tjr|S|d}|d}|duo|du}tj||}| o|dd|_|d}| |r tjn tj|_nt|tr |r tjn tj|_nt|tr| }|dvrtj|_nM|dkrtj |_n5|d vrtj|_n|r tjn tj|_d |vrD| |d |d |d  d|vr||d|xjtjzc_|xjtjzc_|S)Nrfrg)cafilergrjTrk)none0falsenooptional)required1trueyesrhrar3)keyfiler3ri)rrN SSLContextr_create_default_contextrj CERT_NONE CERT_REQUIREDrkr~rlower CERT_OPTIONALload_cert_chain set_ciphersoptions OP_NO_SSLv2 OP_NO_SSLv3)rsslprfrghasnocarverify_mode_values rrzConnection._create_ssl_ctxrs dCN + + K XXd^^(##*/4(6BBB!([MTXX6F-M-M HH]33  $/6McmmC$5$;$;$=$=! $@@@"%-"j00"%"3"&FFF"%"33:"Q#--@Q T>>   V dhhuoo@T@T     t   OODN + + + s&  s&  r!cD|jrtjdd|_|jdSt jddt j} ||n#t$rYnwxYw| dS#| wxYw)z Send the quit message and close the socket. See `Connection.close() `_ in the specification. :raise Error: If the connection is already closed. Already closedTN`_ in the specification. COMMITNrrs rcommitzConnection.commits5 g/::: r!cn|tjd|dS)z Roll back the current transaction. See `Connection.rollback() `_ in the specification. ROLLBACKNrrs rrollbackzConnection.rollbacks5 g/<<< r!c|tjdt|}||jS)z%Send the "SHOW WARNINGS" SQL command.z SHOW WARNINGS)rrr MySQLResultrrows)rresults r show_warningszConnection.show_warningss= g/AAAT"" {r!cn|tj||dS)zI Set current db. :param db: The name of the db. N)rr COM_INIT_DBr)rrYs r select_dbzConnection.select_dbs5 g12666 r!ct|trd||zdzSt|ttfr#||}|jrd|z}|Stj||j |S)zxEscape whatever value is passed. Non-standard, for internal use; do not use this in your applications. '_binary)mapping) rr escape_stringr+ bytearray _quote_bytesrr escape_itemr8)robjrrets rrzConnection.escapes c3   7++C00036 6 cE9- . . ##C((C" &#oJ%c4<IIIIr!c8|||jS)zkAlias for escape(). Non-standard, for internal use; do not use this in your applications. )rr)rrs rliteralzConnection.literal s {{3 ...r!c~|jtjzr|ddSt j|S)Nrz'')rr "SERVER_STATUS_NO_BACKSLASH_ESCAPESreplacer rrss rrzConnection.escape_strings:   P P (99S$'' ''***r!c|jtjzr=d|ddddSt j|S)Nz'{}''s''asciisurrogateescape)rr rformatr decoder escape_bytesr s rrzConnection._quote_bytess`   P P == $&&--g7HII &q)))r!cF|r ||S||S)a  Create a new cursor to execute queries with. :param cursor: The type of cursor to create. None means use Cursor. :type cursor: :py:class:`Cursor`, :py:class:`SSCursor`, :py:class:`DictCursor`, or :py:class:`SSDictCursor`. )r?)rcursors rrzConnection.cursor s.  6$<< %%%r!ct|tr||jd}|t j||||_|jS)Nr unbuffered) rrrrrrr_read_query_resultr)rsqlrs rqueryzConnection.query-sg c3   ?**T],=>>C g/555"555LL""r!cF|||_|jS)Nr)rr)rrs r next_resultzConnection.next_result6s$"555LL""r!c|jSr^)rrs r affected_rowszConnection.affected_rows: ""r!ctjd|}|tj||S)Nr)rrrrCOM_PROCESS_KILLr)r thread_idrbs rkillzConnection.kill=s>k$ ** g6<<<##%%%r!cR|j-|r|d}ntjd |t jd|dS#t$r0|r,|| dYdSwxYw)z Check if the server is alive. :param reconnect: If the connection is closed, reconnect. :type reconnect: boolean :raise Error: If the connection is closed and reconnect=False. NFrr0) rrrrrrCOM_PINGrr`ping)r reconnects rr&zConnection.pingBs :  2 ! i 0111   ! !'"2B 7 7 7  " " " " "      %        s4A,,5B&$B&c0||dS)z,Deprecated. Use set_character_set() instead.N)set_character_set)rr8s r set_charsetzConnection.set_charset[s w'''''r!ct|j}|r d|d|}nd|}|tj||||_||_||_dS)z Set charaset (and collation) Send "SET NAMES charset [COLLATE collation]" query. Update Connection.encoding based on charset. z SET NAMES z COLLATE N)rrrrrrr8r9)rr8r9rrs rr)zConnection.set_character_setcs#7++4  +>>>9>>EE***E g/777    "r!c d|_ ||jrtjtjtj}||j||jd|_d|_ trtdni}|j |j df|d< tj |j|jf|jfi|}n-#t $r }|jt"jkrYd}~Kd}~wwxYwd|j|jfz|_trtd|tjtjd |tjtjd |d||_|d |_d|_||||j|j |j!D|"}|#d |j!f|$|j%B|"}|#|j%|$|j&|'|j&dSdS#tP$r}d|_| |$n#YnxYwtS|t tTfrgtWj,tZj.d |jd |d}||_/taj1|_0trt|j0|d}~wwxYw)NFzLocalhost via UNIX socketTzconnected using unix_socketrsource_addressz socket %s:%dzconnected using socketrrbzSET sql_mode=%sz!Can't connect to MySQL server on z ())2rr6reAF_UNIX SOCK_STREAM settimeoutrArr_secureDEBUGprintrJcreate_connectionr4r7OSErrorerrnoEINTR setsockopt IPPROTO_TCP TCP_NODELAY SOL_SOCKET SO_KEEPALIVErmakefiler _next_seq_id_get_server_information_request_authenticationr)r8r9r:rexecuterr@rrC BaseExceptionrIOErrorrrr CR_CONN_HOST_ERRORoriginal_exception traceback format_exc)rsockkwargsecexcs rrzConnection.connectwsm X |#O!=9KLLDOOD$8999LL!1222%@DN#'DL=;<<<F(4484Eq3I/0 ""#)#;!%DI 68L$$PV$$D"&""" w%+55 (!"&4ty$)6L%LDN86777OOF$68JANNNOOF$5v7JANNN%%%DJ----DK !D   ( ( * * *  ( ( * * *  " "4< @ @ @}(KKMM +dm-=>>>  ,KKMM $+,,, #/ 4555550/   DKJJLLLLD!gw/00 *)K KKqKKK *+& ) 4 6 6 )#-((( / sbB"J>,$CJ> C;C60J>5C66C;;F?J>> M7 M2K'&M2'K+)B M22M7ctt|t|jgz|z}trt ||||jdzdz|_dS)zvWrites an entire "mysql packet" in its entirety to the network adding its length and sequence number. rN)r lenr+r@r4rr)rpayloaddatas r write_packetzConnection.write_packetst 3w<<((5$2C1D+E+EEO       $!.2c9r!ct} |d}tjd|\}}}||dzz}||jkrW||dkrt jtj dt j d||jfz|jdzd z|_||}trt|||z }|tkrn|t||j} | r5|j|jjdur d |j_| | S) a!Read an entire "mysql packet" in its entirety from the network and return a MysqlPacket type that represents the results. :raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError: If the packet sequence number is wrong. Tz>Bcd|_|r9 t|}|n7#d|_d|_xYwt|}|||_|j |j|_|jS)NF)rrinit_unbuffered_queryr_ connectionrrr)rrrs rrzConnection._read_query_result-s   $T**,,.... +0($(! &&F KKMMM   +!'!5D ##s #/Ac,|jr |jjSdSNr)r insert_idrs rrtzConnection.insert_id?s < <) )1r!c`|jstjdd|jl|jjr-t jd|j|jjr | |jj d|_t|tr| |j }ttt!|dz}t#jd||}||d|dz z}||t(rt+|d|_|tkrdS||dz d} ttt!|}||d|||d}|s |tkrdSY)z~ :raise InterfaceError: If the connection is closed. :raise ValueError: If no username was specified. rr0Nz.Previous unbuffered result was left incompleterr)rrInterfaceErrorrr_warningswarn_finish_unbuffered_queryhas_nextrrrrrminr]rQrrrr4rr@rT)rcommandr packet_sizepreluderis rrzConnection._execute_commandEs z ,$Q++ + < #|- 8 NOOO 55777,' #  """,' #DL c3   ,**T]++C.#c((Q,77 +e['::30q011 &!!!       ' ' F+/##$ nc#hh77K   c,;,/ 0 0 0kll#C ;77  r!c t|jddddkr|xjtjzc_|jtdt|j j }t|jtr$|j |j|_tjd|jt"|d}|jrz|jtjzrf|||j|j|j|_|jd |_d |_||jzd z}d}d}|jd kr"d}t=j|j |j!}n|jd kr"d}t=j|j |j!}n|jdkrVd}|j r6tDrtGdt=j$|j |j!}nVtDrtGdn?|jdkr4d}|jr|jtjzr |j d z}n |j rd}nd }|jtj%zr#|tMtO||zz }nE|jtj(zr)|tjdtO||zz }n||d zz }|j)r_|jtj*zrKt|j)tr$|j) |j|_)||j)d zz }|jtj+zr ||pdd zz }|jtj,zrd}|j-.D]s\}}| d}|tMtO||zz }| d}|tMtO||zz }t|tMtO||zz }|||/} | 0rtDrtGd| 1| 2}|jtj+zr||3|| } ntij5d| 6rrtDrtGd|jdkrt=j7|| } n;|jdkrt=j8|| } ntij5d|jtDrtGddSdS)N.rrzDid not specify a usernamezr MULTI_RESULTSr2r*rr8idrrrrrrr]rNserver_capabilitiesrrTr wrap_socketrr4r?rr3_auth_plugin_namerscramble_native_passwordr3saltr4r5scramble_caching_sha2PLUGIN_AUTH_LENENC_CLIENT_DATAr-rQSECURE_CONNECTIONrYr PLUGIN_AUTH CONNECT_ATTRSrrris_auth_switch_request read_uint8 read_string _process_authrris_extra_auth_datacaching_sha2_password_authsha256_password_auth) r charset_id data_initrSauthresp plugin_name connect_attrsrurv auth_packets rrBz"Connection._request_authenticationpsn t"((a003 4 4 9 9    4 4   9 9:: :$T\225 di % % 8 ((77DIK t'S   8 06:=   i ( ( (--dj$)-TTDJ*--d33DKDL49$u,  !R ' 'K5dmTYOOHH  #'> > >2K5dmTYOOHH  #'> > >2K} :<:;;; 6t}diPP:8999  #'8 8 8,Kx !D4vzA !=50 !    #f&K K % KH ..9 9DD  %(@ @ % FKS]]33h> >DD Hu$ $D 7 $t/&2HH $$'3'' 8'..77 DGeO #D  #f&8 8 1 ['C50 0D  #f&: : DM+1133 9 91HHW%%SVV!4!4q!88 HHW%%SVV!4!4q!88 KM 2 233mC CD $''))   - - / /  .,---  " " $ $ $%1133K(6+== S+"00kJJ *+QRRR  + + - -  -+,,,%)@@@#>t[QQ '+<<<#8{KK *>@V  % # $ $ $ $ $ % %r!c R||}|r_ ||S#t$r<|dkr3tjt jd|dt|dYnwxYw|dkrtj ||S|dkrtj ||S|dkr.tj |j | }n |dkr.tj|j | }n|d kr1tj|j | d z}n|d kr |j d z}n|dkrc|} |}|d zdk}|dzdk}| } | dkr||j d zn|rd} ||| } || d zn#t$r'tjt jd|d|dt&$r,tjt jd|d|d| d| wxYwtjt jd|d|}||s|rn^|Stjt jd|z|||}||S)NsdialogAuthentication plugin '' not loaded: - z missing authenticate methodrrrsclient_ed25519smysql_old_passwordrsmysql_clear_passwordTrs Password: z3no response - TypeError within plugin.prompt methodz missing prompt methodz' z' didn't respond with string. Returned 'z ' to prompt z' not configuredz)Authentication plugin '%s' not configured)_get_auth_plugin_handler authenticateAttributeErrorrrr CR_AUTH_PLUGIN_CANNOT_LOADrqrrrrr3read_alled25519_passwordscramble_old_passwordrrTprompt TypeErrorCR_AUTH_PLUGIN_ERRr check_errorr) rrrhandlerrSrflagecholastrresps rrzConnection._process_auths// <<   ++K888!   )++.5X+XX*.w--XXX,+  2 2 23D+FF F . . .-dK@@ @ 4 4 41$-AUAUAWAWXXDD - - -)$-9M9M9O9OPPDD 1 1 1+DM;;O;O;Q;QRR D3 3 3=5(DD I % %C! ~~''t ,t ,]**%%dme&;<<<<PD&~~dF;;))$,7777)!29PkPP.5PPP %!21qkqq 'qqRVqqflqq.5O+OOO''))!!!##%%C! DJ&-;kI  $!!  s.AA43A4 .G::A%Ic L|j|}|sBt|tr-|j|d}|rA ||}n6#t $r't jtj d|d|dwxYwd}|S)Nrrrz- cannot be constructed with connection object) rr_rr+rrrrr r)rr plugin_classrs rrz#Connection._get_auth_plugin_handler*s,00==  R ; > > R044[5G5G5P5PQQL   &,t,,   *1dkdd&2ddd Gs " A..1Bc|jdSrs)server_thread_idrs rr"zConnection.thread_id<s$Q''r!c|jSr^)r8rs rcharacter_set_namezConnection.character_set_name?s |r!c|jSr^)rrs r get_host_infozConnection.get_host_infoBs ~r!c|jSr^)protocol_versionrs rget_proto_infozConnection.get_proto_infoEs $$r!c d}|}|}|||_|dz }|d|}|||d|_|dz}t jd|||dz|_|dz }|||dz|_ |dz }t jd |||d zd|_ |d z }t||d zkrt jd |||d z\}}}}|d z }||_ t|j|_n#t $r d|_YnwxYw||_t$rt'd |z|xj |dzzc_ t$rt'd|t)d|dz }|dz }t|||zkr |xj ||||zz c_ ||z }|dz }|j t*jzrwt||krf|d|}|dkr$||dd|_dS|||d|_dSdSdS)NrrrrmrrV r%rrz## + + +&*### +"&D  2)D0111  $ $ 3 $ $ -k8,,,2x!|,,H R t99H $ $ IIa!h,./ /II MA Q  #f&8 8 LSYY!^^ 5!,,JA~~)-abb)A)A&&&)-a l);)B)B7)K)K&&& L L^^s3E E! E!c|jSr^)rrs rget_server_infozConnection.get_server_inforr!r^)F)T)D__name__ __module__ __qualname____doc__rrrr3rrrrrrpropertyrr__del__rCrrrrrrrrrrrrrrrrr#r&r*r)rrTrrrYrrrtrrBrrr"rrrrArrWarningrrv DatabaseError DataErrorrIntegrityErrorr\ProgrammingErrorNotSupportedErrorror!rr/r/[sEEN EGG    +   UAAAAAF   D   ,&&X&G))) QQQ     J J J J///+++ *** & & & &###########&&& 2(((####(ZZZZx : : :(3))))V2$$$$$ )))Vl%l%l%\JJJX$(((%%%?L?L?LB###kG IE'N%M I+'N%M+-r!r/c\eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdS)rc||_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)z. :type connection: Connection NrF) rqrrtr warning_countmessage field_count descriptionrrzr_)rrqs rrzMySQLResult.__init__s]%!!   !&r!c@|jr|dSdSr^)r_ryrs rrzMySQLResult.__del__s/  ! ,  ) ) + + + + + , ,r!c2 |j}|r||n?|r||n||d|_dS#d|_wxYwr^)rqrrris_load_local_packet_read_load_local_packet_read_result_packetr first_packets rrzMySQLResult.reads #?7799L((** 7$$\22222244 7,,\::::((666"DOOOdDO " " " "s BB Bcd|_|j}|r%||d|_d|_dS|r%||d|_d|_dS||_| d|_ dS)zw :raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError: TFNl) r_rqrrrrrread_length_encoded_integerr_get_descriptionsrrs rrpz!MySQLResult.init_unbuffered_querys "&3355  $ $ & & 6   . . .%*D ""DOOO  . . 0 0 6  ( ( 6 6 6%*D ""DOOO+GGIID   " " $ $ $ "6D   r!ct|}|j|_|j|_|j|_|j|_|j|_|j|_dSr^)rrrtrrrrz)rr ok_packets rrzMySQLResult._read_ok_packetsR#L11 &4",&4&4 ( !* r!c|jjstdt|}t |j|j} |n#|jxYw|j}|stj tj d| |dS)NzF**WARN**: Received LOAD_LOCAL packet but local_infile option is false.zCommands Out of Sync)rqr RuntimeErrorr LoadLocalFilefilenamerrrrrr rr)rr load_packetsenderrs rrz#MySQLResult._read_load_local_packets, X -\:: {3T_EE          O ( ( * * * O0022 &&(( &*&  Y'''''s AA7c|sdSt|}|j|_|j|_dS)NFT) is_eof_packetrrrz)rriwps r_check_packet_is_eofz MySQLResult._check_packet_is_eofsC##%% 5 f % %-  tr!c||_||dSr^)rrr_read_rowdata_packetrs rrzMySQLResult._read_result_packets@'CCEE     !!#####r!c|jsdS|j}||rd|_d|_d|_dS||}d|_|f|_|S)NFr)r_rqrrr_read_row_from_packetr)rrirows r_read_rowdata_packet_unbufferedz+MySQLResult._read_rowdata_packet_unbuffereds%  F--//  $ $V , , %*D ""DODI F((00F  r!cD|jr |j}nQ#tj$r?}|jdt jt jfvrd|_d|_Yd}~dSd}~wwxYw| |rd|_d|_|jdSdS)NrF) r_rqrrrargsr QUERY_TIMEOUTSTATEMENT_TIMEOUTr)rrirLs rryz$MySQLResult._finish_unbuffered_querys$ ' 5577'   6!9$(! .3D*&*DOFFFFF ((00 ').&"&#$ ' ' ' ' 's#A13A,+A,,A1cg} |j}||rd|_n)|||_t ||_t||_dS)z:Read a rowdata packet for each data row in the result set.TN) rqrrappendrrQrtupler)rrris rrz MySQLResult._read_rowdata_packet.s <_1133F((00 "& KK226:: ; ; ;  <!YY$KK r!c0g}|jD]~\}} |}n#t$rYnWwxYw|;|||}trt d|| ||}||t|S)NzDEBUG: DATA = )r read_length_coded_string IndexErrorrr4r5r r)rrirr converterrSs rrz!MySQLResult._read_row_from_packet;s#'?   Hi 6688    ';;x00D2*D111($9T??D JJt    Szzs % 33c"g|_g|_|jj}|jj}g}t |jD]}|jt}|j || | |j }|r0|tj kr|}n|tvr|jdkrd}n|}nd}nd}|jj|}|tjurd}t&rt)d|d||j ||f|j} | s Jdt-||_ dS)z>Read a column descriptor packet for each column in the result.?Nrz DEBUG: field=z , converter=zProtocol error, expecting EOF)fieldsr rqr=rrangerrrr r type_coder JSON TEXT_TYPES charsetnrrr_throughr4r5rr) rr= conn_encodingrr,field field_typerr eof_packets rrzMySQLResult._get_descriptionsNs o1 0  t'(( : :AO001FGGE K  u % % %   u0022 3 3 3J 00 -HH:--",,#'#0 'HH044Z@@IJ...  FDeDDDDEEE O " "Hi#8 9 9 9 9_1133 ''))JJ+JJJ) --r!N)rrrrrrrprrrrrryrrrror!rrrs''' ,,, # # #6662+++(((.   $$$ $'''.    &).).).).).r!rceZdZdZdZdS)rc"||_||_dSr^)rrq)rrrqs rrzLoadLocalFile.__init__{s  $r!c*|jjstjdd|j} t |jd5}t |jd} ||}|sn| |. dddn #1swxYwYn6#t$r)tj tj d|jdwxYw|js| d dSdS#|js| d wwxYw) z3Send data packets from the local file to the serverrr0r.i@TNzCan't find file 'rr!)rqrrrvrrr{rErrTr7rr FILE_NOT_FOUNDr)rconn open_filer}chunks rrzLoadLocalFile.send_datas$ ,$Q++ +? 'dmT** -i!+Y -%NN;77E %%e,,, - - - - - - - - - - - - - - - -   &!4DM444   < '!!#&&&&& ' '4< '!!#&&&& 'sABAB BBBBBC33CC33DN)rrrrrror!rrrzs2%%%'''''r!r):r8rrerrrHrwr0rr8rr constantsrrr r r r r cursorsr optionfilerprotocolrrrrrrrrrNr ImportErrorgetpassgetuserrrr4BITBLOB LONG_BLOB MEDIUM_BLOBSTRING TINY_BLOB VAR_STRINGVARCHARGEOMETRYrrr]r r-r/rrror!rr7s  33333333IIIIIIIIIIIIIIII"!!!!!!!JJJKK CKKKNNN"7?$$LXLLL NO  $$$    &z.z.z.z.z.z.z.z.z!_._._._._._._._.D''''''''''s$&A-- A98A9=B BB