
    "iH                        d Z 	 e n# e$ r eZY nw xY wdZdZegZ	 ddlZ e	d eD                       Z
dZn# e$ r dZY nw xY wddlmZmZmZ 	 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ 	 ddlmZ e                    e           n# e$ r Y nw xY we                    e            eed          rej        ZddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ddlm'Z' ddlm(Z( ddlm)Z) ddlm*Z* i Z+e&j,        j-        .                                D ]\  Z/Z0e0e+d1                    e/          <   e&j2        j-        .                                D ]\  Z/Z0e0e+d1                    e/          <   e&j3        j4        .                                D ]\  Z/Z0e0e+d 1                    e/          <   e j5        .                                D ]\  Z/Z0e0e+d!1                    e/          <   e j6        j7        .                                D ]\  Z/Z0e0e+d"1                    e/          <   e j8        j9        .                                D ]\  Z/Z0e0e+d#1                    e/          <   e j:        j;        .                                D ]\  Z/Z0e0e+d$1                    e/          <   e"j<        j-        .                                D ]\  Z/Z0e0e+d%1                    e/          <   e"j=        j-        .                                D ]\  Z/Z0e0e+d&1                    e/          <   e#j>        j?        j@        .                                D ]\  Z/Z0e0e+d'1                    e/          <   e#j>        j?        jA        .                                D ]\  Z/Z0e0e+d(1                    e/          <   e#j>        jB        .                                D ]\  Z/Z0e0e+d)1                    e/          <   e$jC        j-        .                                D ]\  Z/Z0e0e+d*1                    e/          <   e$jD        j-        .                                D ]\  Z/Z0e0e+d+1                    e/          <   e%jE        jF        .                                D ]\  Z/Z0e0e+d,1                    e/          <   e%jG        jH        .                                D ]\  Z/Z0e0e+d-1                    e/          <   e%jI        jJ        .                                D ]\  Z/Z0e0e+d.1                    e/          <   e'jK        jL        j-        .                                D ]\  Z/Z0e0e+d/1                    e/          <   e(jM        jN        .                                D ]\  Z/Z0e0e+d01                    e/          <    ejO                    ZP ejQ        eP          ZRePS                    ejT        U                    ejV        jW                             ePS                    ejT        U                    e jV        jW                             ePS                    ejT        U                    e!jV        jW                             ePS                    ejT        U                    e"jV        jW                             ePS                    ejT        U                    e#jV        jW                             ePS                    ejT        U                    e$jV        jW                             ePS                    ejT        U                    e%jV        jW                             ePS                    ejT        U                    e&jV        jW                             ePS                    ejT        U                    e'jV        jW                             ePS                    ejT        U                    e(jV        jW                             ePS                    ejT        U                    e)jV        jW                             ePS                    ejT        U                    e*jV        jW                              e	d1 eD                       Z
dZXdZY G d2 d3eZ          Z[n># eee\e]f$ r2Z^dZXee^nd4ZYes ed51                    eY                    Y dZ^[^ndZ^[^ww xY wd6d7d8d9d:d;Z_ G d< d=eZ          Z` G d> d?eZ          Zad@ ZbdS )AzXThis module contains the implementation of a helper class for MySQL X
Protobuf messages.))zMysqlx.ServerMessages.Type.OKz	Mysqlx.Ok)z Mysqlx.ServerMessages.Type.ERRORzMysqlx.Error)z,Mysqlx.ServerMessages.Type.CONN_CAPABILITIESzMysqlx.Connection.Capabilities)z5Mysqlx.ServerMessages.Type.SESS_AUTHENTICATE_CONTINUEz#Mysqlx.Session.AuthenticateContinue)z/Mysqlx.ServerMessages.Type.SESS_AUTHENTICATE_OKzMysqlx.Session.AuthenticateOk)z!Mysqlx.ServerMessages.Type.NOTICEzMysqlx.Notice.Frame)z5Mysqlx.ServerMessages.Type.RESULTSET_COLUMN_META_DATAzMysqlx.Resultset.ColumnMetaData)z(Mysqlx.ServerMessages.Type.RESULTSET_ROWzMysqlx.Resultset.Row)z/Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONEzMysqlx.Resultset.FetchDone)z4Mysqlx.ServerMessages.Type.RESULTSET_FETCH_SUSPENDEDzMysqlx.Resultset.FetchSuspended)z?Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONE_MORE_RESULTSETSz(Mysqlx.Resultset.FetchDoneMoreResultsets)z.Mysqlx.ServerMessages.Type.SQL_STMT_EXECUTE_OKzMysqlx.Sql.StmtExecuteOk)z?Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONE_MORE_OUT_PARAMSz'Mysqlx.Resultset.FetchDoneMoreOutParams)z&Mysqlx.ServerMessages.Type.COMPRESSIONzMysqlx.Connection.CompressionN    c                 Z    g | ](\  }}t          t          j        |                    |f)S  )int	_mysqlxpb
enum_value.0keyvals      P/srv/django_bis/venv311/lib/python3.11/site-packages/mysqlx/protobuf/__init__.py
<listcomp>r   I   sJ     E E E (S !!5c!:!:;;SA E E E    TF   )
BYTE_TYPESNUMERIC_TYPESencode_to_bytes)protobuf)descriptor_database)descriptor_pb2)descriptor_pool)message_factory)RepeatedCompositeFieldContainer)RepeatedCompositeContainer__version__   )mysqlx_connection_pb2)mysqlx_crud_pb2)mysqlx_cursor_pb2)mysqlx_datatypes_pb2)mysqlx_expect_pb2)mysqlx_expr_pb2)mysqlx_notice_pb2)
mysqlx_pb2)mysqlx_prepare_pb2)mysqlx_resultset_pb2)mysqlx_session_pb2)mysqlx_sql_pb2zMysqlx.ClientMessages.Type.{0}zMysqlx.ServerMessages.Type.{0}zMysqlx.Error.Severity.{0}zMysqlx.Crud.DataModel.{0}zMysqlx.Crud.Find.RowLock.{0}zMysqlx.Crud.Order.Direction.{0}z*Mysqlx.Crud.UpdateOperation.UpdateType.{0}z Mysqlx.Datatypes.Scalar.Type.{0}zMysqlx.Datatypes.Any.Type.{0}z3Mysqlx.Expect.Open.Condition.ConditionOperation.{0}z$Mysqlx.Expect.Open.Condition.Key.{0}z#Mysqlx.Expect.Open.CtxOperation.{0}zMysqlx.Expr.Expr.Type.{0}z%Mysqlx.Expr.DocumentPathItem.Type.{0}zMysqlx.Notice.Frame.Scope.{0}zMysqlx.Notice.Warning.Level.{0}z/Mysqlx.Notice.SessionStateChanged.Parameter.{0}z,Mysqlx.Prepare.Prepare.OneOfMessage.Type.{0}z-Mysqlx.Resultset.ColumnMetaData.FieldType.{0}c                 2    g | ]\  }}t           |         |fS r   	_MESSAGESr   s      r   r   r      s%    GGG83)C.#	GGGr   c                       e Zd ZdZ ej                    Zed             Zed             Z	ed             Z
ed             Zed             Zed             ZdS )	_mysqlxpb_purez]This class implements the methods in pure Python used by the
        _mysqlxpb C++ extension.c                     t           j                            t                              |                     } |            S N)r,   factoryGetPrototype_DESCRIPTOR_POOLFindMessageTypeByName)nameclss     r   new_messagez_mysqlxpb_pure.new_message   s6     (55 66t<<> >C355Lr   c                     t           |          S r.   r)   )r
   s    r   r   z_mysqlxpb_pure.enum_value   s    S>!r   c                 *    |                                  S r.   )SerializeToStringmsgs    r   serialize_messagez _mysqlxpb_pure.serialize_message   s    ((***r   c                 *    |                                  S r.   )SerializePartialToStringr9   s    r   serialize_partial_messagez(_mysqlxpb_pure.serialize_partial_message   s    //111r   c                 d    t                               |           }|                    |           |S r.   )r,   r5   ParseFromString)msg_type_namepayloadr:   s      r   parse_messagez_mysqlxpb_pure.parse_message   s.     ,,];;C(((Jr   c                     t                               |           }|s"t          d                    |                     t                              |          }|                    |           |S )NzUnknown msg_type: {0})SERVER_MESSAGESget
ValueErrorformatr,   r5   r@   )msg_typerB   rA   r:   s       r   parse_server_messagez#_mysqlxpb_pure.parse_server_message   sg    +//99M  K !8!?!?!I!IJJJ ,,];;C(((Jr   N)__name__
__module____qualname____doc__r   MessageFactoryr/   staticmethodr5   r   r;   r>   rC   rJ   r   r   r   r,   r,      s        	$ 	$ 1/022		 	 
	
 
	" 	" 
	" 
	+ 	+ 
	+ 
	2 	2 
	2 
	 	 
	
 
	 	 
	 	 	r   r,   zProtobuf >=3.0.0 is requiredProtobuf is not available: {})z-Mysqlx.Prepare.Prepare.OneOfMessage.Type.FINDfind)z/Mysqlx.Prepare.Prepare.OneOfMessage.Type.INSERTinsert)z/Mysqlx.Prepare.Prepare.OneOfMessage.Type.UPDATEupdate)z/Mysqlx.Prepare.Prepare.OneOfMessage.Type.DELETEdelete)z-Mysqlx.Prepare.Prepare.OneOfMessage.Type.STMTstmt_execute)z$Mysqlx.ClientMessages.Type.CRUD_FINDz&Mysqlx.ClientMessages.Type.CRUD_INSERTz&Mysqlx.ClientMessages.Type.CRUD_UPDATEz&Mysqlx.ClientMessages.Type.CRUD_DELETEz+Mysqlx.ClientMessages.Type.SQL_STMT_EXECUTEc                   @    e Zd ZdZereneZerdndZe	d             Z
dS )ProtobufzProtobuf class acts as a container of the Protobuf message class.
    It allows the switch between the C extension and pure Python implementation
    message handlers, by patching the `mysqlxpb` class attribute.
    FTc                     | r.t           s't          d                    t                              | st          st          d          | rt
          nt          t          _        | t          _	        dS )zSets whether to use the C extension or pure Python implementation.

        Args:
            use_pure (bool): `True` to use pure Python implementation.
        rQ   z-MySQL X Protobuf C extension is not availableN)
HAVE_PROTOBUFImportErrorrH   HAVE_PROTOBUF_ERRORHAVE_MYSQLXPB_CEXTr,   r   rX   mysqlxpbuse_pure)r_   s    r   set_use_purezProtobuf.set_use_pure  sz      	OM 	O !!'(;!<!<> > > 	O"4 	OMNNN.6ENNI$r   N)rK   rL   rM   rN   r]   r   r,   r^   r_   rP   r`   r   r   r   rX   rX     sU          /ByyNH*4uuH% % \% % %r   rX   c                       e Zd ZdZddZd Zd Zd Zd ZddZ	d	 Z
d
 Zd Zd Zed             Zed             Zed             Zed             Zed             Zed             ZdS )MessagezHelper class for interfacing with the MySQL X Protobuf extension.

    Args:
        msg_type_name (string): Protobuf type name.
        **kwargs: Arbitrary keyword arguments with values for the message.
    Nc                     |rt           j                            |          nd | j        d<   |                                D ]\  }}|                     ||           d S )N_msg)rX   r^   r5   __dict__items__setattr__)selfrA   kwargsr
   values        r   __init__zMessage.__init__-  sm    !' 1 = =m L L L"& 	f ,,.. 	) 	)JCS%((((	) 	)r   c                    t           j        r(t          |t                    r%t	          | j        |t          |                     d S t          |t          t          f          rt	          | j        ||           d S t          |t                    r*t          | j        |                              |           d S t          |t                    r<t          | j        |                              |                                           d S t          | j        |                              |           d S t          |t                    r|                                n|| j        |<   d S r.   )rX   r_   
isinstancestrsetattrrd   r   r   r   listgetattrextendrb   	MergeFromget_messagerh   r3   rj   s      r   rg   zMessage.__setattr__3  sK    	9%%% 	:	4)?)?@@@@@EM:#>?? :	4/////E4(( :	4((//66666E7++ :	4((2253D3D3F3FGGGGG	4((22599999 eW--9e//11138 IdOOOr   c                     	 t           j        s| j        |         nt          | j        |          S # t          $ r t
          w xY wr.   )rX   r_   rd   rq   KeyErrorAttributeErrorrh   r3   s     r   __getattr__zMessage.__getattr__C  sQ    	!*2*; .49T??TY--. 	! 	! 	!  	!s	   -0 Ac                 2    |                      ||           d S r.   )rg   ru   s      r   __setitem__zMessage.__setitem__J  s    u%%%%%r   c                 ,    |                      |          S r.   )rz   ry   s     r   __getitem__zMessage.__getitem__M  s    %%%r   c                     t           j        s!| j        d                             ||          nt	          | j        d         ||          S )a  Returns the value of an element of the message dictionary.

        Args:
            name (string): Key name.
            default (object): The default value if the key does not exists.

        Returns:
            object: The value of the provided key name.
        rd   )rX   r_   re   rF   rq   )rh   r3   defaults      r   rF   zMessage.getP  sH     $Bt}V$((w777DM&14AA	Br   c                     || j         d<   dS )zdSets the message.

        Args:
            msg (dict): Dictionary representing a message.
        rd   Nre   )rh   r:   s     r   set_messagezMessage.set_message^  s     !$fr   c                     | j         d         S )zReturns the dictionary representing a message containing parsed
        data.

        Returns:
            dict: The dictionary representing a message containing parsed data.
        rd   r   rh   s    r   rt   zMessage.get_messagef  s     }V$$r   c                 J    t           j                            | j                  S )zSerializes a message to a string.

        Returns:
            str: A string representing a message containing parsed data.
        )rX   r^   r;   rd   r   s    r   serialize_to_stringzMessage.serialize_to_stringo  s      2249===r   c                 J    t           j                            | j                  S )zSerializes the protocol message to a binary string.

        This method is similar to serialize_to_string but doesn't check if the
        message is initialized.

        Returns:
            str: A string representation of the partial message.
        )rX   r^   r>   rd   r   s    r   serialize_partial_to_stringz#Message.serialize_partial_to_stringw  s      ::49EEEr   c                 V    t           j        s| j        d         n| j        j        j        S )zstring: Message type name._mysqlxpb_type_name)rX   r_   rd   
DESCRIPTOR	full_namer   s    r   typezMessage.type  s-     8@7H 0ty.//%/	0r   c                 B    t           j                            | |          S )a>  Creates a new message, initialized with parsed data.

        Args:
            msg_type_name (string): Message type name.
            payload (string): Serialized message data.

        Returns:
            dict: The dictionary representing a message containing parsed data.

        .. versionadded:: 8.0.21
        )rX   r^   rC   )rA   rB   s     r   parsezMessage.parse  s      ..}gFFFr   c                     t           j        r|                                 n-t          t	          |                                                     S )zReturns the size of the message in bytes.

        Args:
            msg (mysqlx.protobuf.Message): MySQL X Protobuf Message.

        Returns:
            int: Size of the message in bytes.

        .. versionadded:: 8.0.21
        )rX   r_   ByteSizelenr   r   r9   s    r   	byte_sizezMessage.byte_size  sA     "*!2 As||~~~_S%<%<%>%>??@@	Ar   c                 B    t           j                            | |          S )a  Creates a new server-side message, initialized with parsed data.

        Args:
            msg_type (int): Message type.
            payload (string): Serialized message data.

        Returns:
            dict: The dictionary representing a message containing parsed data.
        )rX   r^   rJ   )rI   rB   s     r   parse_from_serverzMessage.parse_from_server  s      55hHHHr   c                      |             }|                     t          j                            ||                     |S )a  Creates a new message, initialized with parsed data and returns a
        :class:`mysqlx.protobuf.Message` object.

        Args:
            msg_type_name (string): Message type name.
            payload (string): Serialized message data.

        Returns:
            mysqlx.protobuf.Message: The Message representing a message
                                     containing parsed data.
        )r   rX   r^   rC   )r4   rA   rB   r:   s       r   from_messagezMessage.from_message  s9     cee)77wOOPPP
r   c                      |             }|                     t          j                            ||                     |S )a  Creates a new server-side message, initialized with parsed data and
        returns a :class:`mysqlx.protobuf.Message` object.

        Args:
            msg_type (int): Message type.
            payload (string): Serialized message data.

        Returns:
            mysqlx.protobuf.Message: The Message representing a message
                                     containing parsed data.
        )r   rX   r^   rJ   )r4   rI   rB   r:   s       r   from_server_messagezMessage.from_server_message  sC     cee228WEE	G 	G 	G
r   r.   )rK   rL   rM   rN   rk   rg   rz   r|   r~   rF   r   rt   r   r   propertyr   rP   r   r   r   classmethodr   r   r   r   r   rb   rb   &  sp        ) ) ) )9 9 9 ! ! !& & && & &B B B B$ $ $% % %> > >	F 	F 	F 0 0 X0
 G G \G A A \A 
I 
I \
I   [    [  r   rb   c                 @    t           j                            |           S )zReturns the value of a MySQL X Protobuf enumerator.

    Args:
        name (string): MySQL X Protobuf numerator name.

    Returns:
        int: Value of the enumerator.
    )rX   r^   r   )r3   s    r   mysqlxpb_enumr     s     ''---r   )crN   ModuleNotFoundError	NameErrorr[   _SERVER_MESSAGES_TUPLESPROTOBUF_VERSIONrp   PROTOBUF_REPEATED_TYPESr   dictrE   r]   helpersr   r   r   googler   google.protobufr   r   r   r   #google.protobuf.internal.containersr   google.protobuf.pyext._messager   appendhasattrr    r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r*   ClientMessagesTyperf   r
   r   rH   ServerMessagesErrorSeverity	DataModelFindRowLockOrder	DirectionUpdateOperation
UpdateTypeScalarAnyOpen	ConditionConditionOperationKeyCtxOperationExprDocumentPathItemFrameScopeWarningLevelSessionStateChanged	ParameterPrepareOneOfMessageColumnMetaData	FieldTypeDescriptorDatabase_DESCRIPTOR_DBDescriptorPoolr1   AddFileDescriptorProto
FromStringr   serialized_pbrZ   r\   objectr,   SyntaxError	TypeErrorerrCRUD_PREPARE_MAPPINGrX   rb   r   r   r   r   <module>r      s8  : & & & &%& >  & d E E,CE E E F FO    A @ @ @ @ @ @ @ @ @m:333333......////////////) ) ) ) ) )	( 	( 	( 	( 	( 	(&&'ABBBB    ""#BCCCwx'' 0#/''''''!!!!!!######&&&&&&######!!!!!!######$$$$$$&&&&&&$$$$$$       I -288:: F FSBE	299#>>??-288:: F FSBE	299#>>??$-3355 A AS=@	-44S99:: $-3355 A AS=@	-44S99::#(06688 D DS@C	077<<==#)399;; G GSCF	3::3??@@#3>DDFF R RSNQ	>EEcJJKK )/4::<< H HSDG	4;;C@@AA(,17799 E ESAD	188==>> &*4GMMOO ( (S$' 	 VC[[	" 	"%*48>>@@ ( (S$' 	 VC[[	" 	"%*7==?? K KSGJ	7>>sCCDD $(-3355 A AS=@	-44S99::#49??AA M MSIL	9@@EEFF &+17799 E ESAD	188==>>%-399;; G GSCF	3::3??@@%9CIIKK ( (S$' 	 VC[[	" 	" '.;@FFHH ( (S$' 	 VC[[	" 	" )7AGGII U USQT	AHHMMNN <(;==N55nEE~9DD(68 8 9 9 9~9DD"02 2 3 3 3~9DD$24 4 5 5 5~9DD'57 7 8 8 8~9DD$24 4 5 5 5~9DD"02 2 3 3 3~9DD$24 4 5 5 5~9DD+- - . . .~9DD%35 5 6 6 6~9DD'57 7 8 8 8~9DD%35 5 6 6 6~9DD!/1 1 2 2 2 dGG/FGGG O M% % % % % % % % %L 	(+yA : : :M!1!=##+  :k #V$788: : 	:: : : : :	:-A/E/E/E4I  % % % % %v % % %0n n n n nf n n nb	. 	. 	. 	. 	.sX    8 AA$a' 5B a' Ba' B_a' '	b"0(bb"