zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
U
¤ý°d«"ã @sèUdZddlmZddlmZmZmZmZddl    m
Z
ddl m Z m Z mZGdd„deƒZGd    d
„d
eƒZGd d „d eƒZGd d„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZeedœdd„Zeeeeefd œd!d"„Zeeeeefd œd#d$„Zd0eee ee e d&œd'd(„Z!ee d)œd*d+„Z"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed,œZ#ee e fe$d-<eeeeeeed.œZ%eee fe$d/<d%S)1zHImplementation of the Python Database API Specification v2.0 exceptions.é)Úunpack)ÚDictÚOptionalÚTupleÚUnioné)Úget_client_error)ÚErrorClassTypesÚ
ErrorTypesÚ
StrOrBytescs^eZdZdZd
eeeeeeeeefdfeeddœ‡fdd„ Z    edœdd    „Z
‡Z S) ÚErrorz<Exception that is base class for all other error exceptions.N.)ÚmsgÚerrnoÚvaluesÚsqlstateÚreturnc
stƒ ¡||_|j|_|pd|_||_|js¦d|jkrDdkr¦nn^t|jƒ|_|dk    r¸z|j||_Wq¸tk
r¢}z|j›d|›d|_W5d}~XYq¸Xn|js¸d|_|_|jrþ|jdkrþ|j|jdœ}|jrìd}|j|d    <nd
}|jf|Ž|_|j|j|jf|_    dS) NéÿÿÿÿiÐi¸ z  (Warning: ú)z Unknown error)rr z{errno} ({state}): {msg}Ústatez{errno}: {msg})
ÚsuperÚ__init__r Ú    _full_msgrrrÚ    TypeErrorÚformatÚargs)Úselfr rrrÚerrÚfieldsÚfmt©Ú    __class__©úDd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\mysqlx/errors.pyr)s,
 
  (  zError.__init__)rcCs|jS)N)r)rr!r!r"Ú__str__Ksz Error.__str__)NNNN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__rÚstrÚintrrrr#Ú __classcell__r!r!rr"r &sûú"r c@seZdZdZdS)ÚInterfaceErrorz.Exception for errors related to the interface.N©r$r%r&r'r!r!r!r"r+Osr+c@seZdZdZdS)Ú DatabaseErrorz-Exception for errors related to the database.Nr,r!r!r!r"r-Ssr-c@seZdZdZdS)Ú InternalErrorz.Exception for errors internal database errors.Nr,r!r!r!r"r.Wsr.c@seZdZdZdS)ÚOperationalErrorz9Exception for errors related to the database's operation.Nr,r!r!r!r"r/[sr/c@seZdZdZdS)ÚProgrammingErrorz(Exception for errors programming errors.Nr,r!r!r!r"r0_sr0c@seZdZdZdS)ÚIntegrityErrorz4Exception for errors regarding relational integrity.Nr,r!r!r!r"r1csr1c@seZdZdZdS)Ú    DataErrorz<Exception for errors reporting problems with processed data.Nr,r!r!r!r"r2gsr2c@seZdZdZdS)ÚNotSupportedErrorzCException for errors when an unsupported database feature was used.Nr,r!r!r!r"r3ksr3c@seZdZdZdS)Ú    PoolErrorz4Exception for errors relating to connection pooling.Nr,r!r!r!r"r4osr4c@seZdZdZdS)Ú TimeoutErrorz4Exception for errors relating to connection timeout.Nr,r!r!r!r"r5ssr5)ÚbufrcCsjt|tƒr|St|ƒ}|dkr&|dS|dkrL|dd|}td|ƒdS|dd|}td|ƒdS)z'Unpacks the given buffer to an integer.rréóz<Iéz<Q)Ú
isinstancer)ÚlenÚ struct_unpack)r6ÚlengthÚtmpr!r!r"Úintreadws
r?)r6ÚsizercCs t|d|…ƒ}||d…|fS)zORead an integer from buffer.
 
    Returns a tuple (truncated buffer, int).
    rN)r?©r6r@Úresr!r!r"Úread_int…srCcCs|d|…}||d…|fS)zdReads bytes from a buffer.
 
    Returns a tuple with buffer less the read bytes, and the bytes.
    rNr!rAr!r!r"Ú
read_bytesŽs rDN)rr rrcCs~zt||||dWStk
r(YnX|s:t||dSzt|dd…|||dWStk
rxt|||dYSXdS)zÑGet the exception matching the MySQL error.
 
    This function will return an exception based on the SQLState. The given
    message will be passed on in the returned exception.
 
    Returns an Exception.
    )r rr)r rréN)Ú_ERROR_EXCEPTIONSÚKeyErrorr-Ú_SQLSTATE_CLASS_EXCEPTION)rr rr!r!r"Úget_mysql_exception—s
 ÿrI)Úpacketrc
Csd}}z|ddkrtdƒ‚Wn6tk
rV}ztd|›dƒWY¢Sd}~XYnXd}zr|dd…}t|dƒ\}}|d    d
kr¢t|ttfƒrœ| d ¡n|}n*t|d d…dƒ\}}| d ¡}| d ¡}Wn<ttfk
r
}ztd|›dƒWY¢Sd}~XYnXt    |||ƒS) z«Returns an exception object based on the MySQL error.
 
    Returns an exception object based on the MySQL error in the given
    packet.
 
    Returns an Error-Object.
    Nr7éÿzPacket is not an error packetz"Failed getting Error information (rérEré#Úutf8r)
Ú
ValueErrorÚ
IndexErrorr+rCr:ÚbytesÚ    bytearrayÚdecoderDrI)rJrÚerrmsgrrr!r!r"Ú get_exception³s*  &   ÿ ý
&rU)Ú02Z07Z08Z0AZ21Z22Z23Z24Z25Z26Z27Z28Z2AZ2BZ2CZ2DZ2EZ33Z34Z35Z37Z3CZ3DZ3FZ40Z42Z44ZHZZXAZ0KZHYrH)iÛiºiÒiÝiii rF)NN)&r'Ústructrr<ÚtypingrrrrZlocalesrÚtypesr    r
r Ú    Exceptionr r+r-r.r/r0r1r2r3r4r5rQr)r?rCrDr(rIrUrHÚ__annotations__rFr!r!r!r"Ú<module>s†  )    
ÿþ %á#ù