
    ,h!                         S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SS	K	J
r
  SS
K	Jr  SSK
Jr  Sr " S S\R                  \R                     5      r " S S\5      r " S S\5      r " S S\5      r\rg)a  

.. dialect:: mysql+mariadbconnector
    :name: MariaDB Connector/Python
    :dbapi: mariadb
    :connectstring: mariadb+mariadbconnector://<user>:<password>@<host>[:<port>]/<dbname>
    :url: https://pypi.org/project/mariadb/

Driver Status
-------------

MariaDB Connector/Python enables Python programs to access MariaDB and MySQL
databases using an API which is compliant with the Python DB API 2.0 (PEP-249).
It is written in C and uses MariaDB Connector/C client library for client server
communication.

Note that the default driver for a ``mariadb://`` connection URI continues to
be ``mysqldb``. ``mariadb+mariadbconnector://`` is required to use this driver.

.. mariadb: https://github.com/mariadb-corporation/mariadb-connector-python

    N)UUID   )MySQLCompiler)MySQLDialect)MySQLExecutionContext   )sql)util)sqltypes)r   r   r   c                       \ rS rSrS rSrg)_MariaDBUUID.   c                 8    U R                   (       a  S nU$ S nU$ )Nc                 f    U b-  [        U S5      (       a  U R                  S5      n [        U 5      n U $ Ndecodeascii)hasattrr   _python_UUIDvalues    b/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/dialects/mysql/mariadbconnector.pyprocess._MariaDBUUID.result_processor.<locals>.process5   s2    $uh// %W 5(/E    c                 x    U b6  [        U S5      (       a  U R                  S5      n [        [        U 5      5      n U $ r   )r   r   strr   r   s    r   r   r   ?   s7    $uh// %W 5U 34Er   )as_uuid)selfdialectcoltyper   s       r   result_processor_MariaDBUUID.result_processor2   s!    << N Nr    N)__name__
__module____qualname____firstlineno__r"   __static_attributes__r$   r   r   r   r   .   s    r   r   c                   >   ^  \ rS rSrSrS rS rU 4S jrS rSr	U =r
$ )&MySQLExecutionContext_mariadbconnectorI   Nc                 4    U R                   R                  SS9$ )NFbuffered_dbapi_connectioncursorr   s    r   create_server_side_cursor@MySQLExecutionContext_mariadbconnector.create_server_side_cursorL   s    %%,,e,<<r   c                 4    U R                   R                  SS9$ )NTr.   r0   r3   s    r   create_default_cursor<MySQLExecutionContext_mariadbconnector.create_default_cursorO   s    %%,,d,;;r   c                    > [         TU ]  5         U R                  R                  U l        U R
                  (       a8  U R                  R                  (       a  U R                  R                  U l	        g g g N)
super	post_execr2   rowcount	_rowcountisinsertcompiledpostfetch_lastrowid	lastrowid
_lastrowid)r   	__class__s    r   r<   0MySQLExecutionContext_mariadbconnector.post_execR   sJ    --==T]]>>"kk33DO ?=r   c                     U R                   $ r:   )rC   r3   s    r   get_lastrowid4MySQLExecutionContext_mariadbconnector.get_lastrowidZ   s    r   )rC   r>   )r%   r&   r'   r(   rC   r4   r7   r<   rG   r)   __classcell__rD   s   @r   r+   r+   I   s!    J=<4 r   r+   c                       \ rS rSrSrg)MySQLCompiler_mariadbconnector^   r$   N)r%   r&   r'   r(   r)   r$   r   r   rL   rL   ^   s    r   rL   c                   2  ^  \ rS rSrSrSrSrSrSrSr	Sr
SrSr\r\rSr\R&                  " \R*                  \R.                  \05      r\R2                  S 5       rU 4S jr\S 5       rU 4S	 jrS
 rS r S r!S r"U 4S jr#S r$S r% SS jr& SS jr'Sr(U =r)$ )MySQLDialect_mariadbconnectorb   mariadbconnectorTutf8mb4qmarkc                    U R                   (       ai  [        U R                   S5      (       aN  [        [        R                  " SU R                   R
                  5       Vs/ s H  n[        U5      PM     sn5      $ gs  snf )N__version__z(\d+)(?:[-\.]?|$))c   rV   rV   )dbapir   tuplerefindallrU   int)r   xs     r   _dbapi_version,MySQLDialect_mariadbconnector._dbapi_version   sm    ::'$**m<<  ZZ,djj.D.D F   s   A<c                    > [         TU ]  " S0 UD6  SU l        U R                  b=  U R                  [
        :  a(  [        SSR                  S [
         5       5      -  5      eg g )NrS   z?The minimum required version for MariaDB Connector/Python is %s.c              3   8   #    U  H  n[        U5      v   M     g 7fr:   )r   ).0r\   s     r   	<genexpr>9MySQLDialect_mariadbconnector.__init__.<locals>.<genexpr>   s     K/J!s1vv/Js   r$   )r;   __init__
paramstylerW   r]   mariadb_cpy_minimum_versionNotImplementedErrorjoin)r   kwargsrD   s     r   re   &MySQLDialect_mariadbconnector.__init__   si    "6"!::!""%@@)-hhK/JKKL  A "r   c                     [        S5      $ )Nmariadb)
__import__)clss    r   import_dbapi*MySQLDialect_mariadbconnector.import_dbapi   s    )$$r   c                    > [         TU ]  XU5      (       a  g[        XR                  R                  5      (       a*  [        U5      R                  5       nSU;   =(       d    SU;   $ g)NTznot connectedzisn't validF)r;   is_disconnect
isinstancerW   Errorr   lower)r   e
connectionr2   str_erD   s        r   rs   +MySQLDialect_mariadbconnector.is_disconnect   sT    7 77::++,,FLLNE"e+E}/EEr   c                 
   UR                  5       nUR                  UR                  5        / SQn/ SQnU H  n[        R                  " X%[
        5        M      U H  n[        R                  " X%[        5        M      UR                  SS5      nU R                  bI   [        U R                  R                  S-   5      R                  R                  nXgR                  -  nXbS'   / U/$ ! [        [        4 a
    SU l         N!f = f)N)connect_timeoutread_timeoutwrite_timeoutclient_flagport	pool_size)local_infilessl_verify_certsslpool_reset_connectioncompressr   r   z.constants.CLIENTF)translate_connect_argsupdatequeryr
   coerce_kw_typer[   boolgetrW   rn   r%   	constantsCLIENT
FOUND_ROWSAttributeErrorImportErrorsupports_sane_rowcount)r   urlopts
int_paramsbool_paramskeyr   CLIENT_FLAGSs           r   create_connect_args1MySQLDialect_mariadbconnector.create_connect_args   s    ))+CII


 C3/ C40 
 hh}a0::!4)JJ''*== )FF  666 #.Dz #K0 4.3+4s   AC( (DDc                 4     UR                   nU$ !   Sn U$ = f)N)errno)r   	exceptionrcs      r   _extract_error_code1MySQLDialect_mariadbconnector._extract_error_code   s(    	B 		B	s    c                     g)NrR   r$   )r   rx   s     r   _detect_charset-MySQLDialect_mariadbconnector._detect_charset   s    r   c                     g)N)SERIALIZABLEzREAD UNCOMMITTEDzREAD COMMITTEDzREPEATABLE READ
AUTOCOMMITr$   )r   dbapi_connections     r   get_isolation_level_values8MySQLDialect_mariadbconnector.get_isolation_level_values   s    
r   c                 N   > US:X  a  SUl         g SUl         [        TU ]	  X5        g )Nr   TF)
autocommitr;   set_isolation_level)r   rx   levelrD   s      r   r   1MySQLDialect_mariadbconnector.set_isolation_level   s(    L $(J!$)J!G'
:r   c           
          UR                  [        R                  " S5      R                  [        R                  " SUSS95      5        g )NzXA BEGIN :xidxidTliteral_executeexecuter	   text
bindparams	bindparamr   rx   r   s      r   do_begin_twophase/MySQLDialect_mariadbconnector.do_begin_twophase   s7    HH_%00eS$?	
r   c           
      $   UR                  [        R                  " S5      R                  [        R                  " SUSS95      5        UR                  [        R                  " S5      R                  [        R                  " SUSS95      5        g )NXA END :xidr   Tr   zXA PREPARE :xidr   r   s      r   do_prepare_twophase1MySQLDialect_mariadbconnector.do_prepare_twophase   so    HH]#..eS$?	

 	HH&'22eS$?	
r   c           
      2   U(       dH  UR                  [        R                  " S5      R                  [        R                  " SUSS95      5        UR                  [        R                  " S5      R                  [        R                  " SUSS95      5        g )Nr   r   Tr   zXA ROLLBACK :xidr   r   rx   r   is_preparedrecovers        r   do_rollback_twophase2MySQLDialect_mariadbconnector.do_rollback_twophase   st     '22MM%dC
 	HH'(33eS$?	
r   c           
          U(       d  U R                  X5        UR                  [        R                  " S5      R	                  [        R
                  " SUSS95      5        g )NzXA COMMIT :xidr   Tr   )r   r   r	   r   r   r   r   s        r   do_commit_twophase0MySQLDialect_mariadbconnector.do_commit_twophase	  sK     $$Z5HH%&11eS$?	
r   )rf   r   )TF)*r%   r&   r'   r(   driversupports_statement_cachesupports_unicode_statementsencodingconvert_unicoder   supports_sane_multi_rowcountsupports_native_decimaldefault_paramstyler+   execution_ctx_clsrL   statement_compilersupports_server_side_cursorsr
   update_copyr   colspecsr   Uuidr   memoized_propertyr]   re   classmethodrp   rs   r   r   r   r   r   r   r   r   r   r)   rI   rJ   s   @r   rO   rO   b   s    F# #'HO!#' " >7#' |<H 
   	 % %%N
;


 :?
  :?	
 	
r   rO   )__doc__rY   uuidr   r   baser   r   r    r	   r
   r   rg   _UUID_RETURNr   r+   rL   rO   r    r$   r   r   <module>r      sv   , 
 %   '    ( 8==!6!67 6-B *	] 	p
L p
f (r   