
    Bh(                       S r SSKJ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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  \	(       aB  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SKJr  SSK J!r!  SSK"J#r#  SSK$J%r%  Sr& " S S \R                  \RN                     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

    )annotationsN)Any)Optional)Sequence)Tuple)TYPE_CHECKING)Union)UUID   )MySQLCompiler)MySQLDialect)MySQLExecutionContext   )sql)util)sqltypes)
Connection)ConnectArgsType)DBAPIConnection)DBAPICursor)DBAPIModule)Dialect)IsolationLevel)PoolProxiedConnection)URL)SQLCompiler)_ResultProcessorType)r   r   r   c                  *    \ rS rSr      SS jrSrg)_MariaDBUUIDA   c                @    U R                   (       a  SS jnU$ SS j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    m/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sqlalchemy/dialects/mysql/mariadbconnector.pyprocess._MariaDBUUID.result_processor.<locals>.processJ   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,   T   s7    $uh// %W 5U 34Er-   )r)   r   returnr   )as_uuid)selfdialectcoltyper+   s       r*   result_processor_MariaDBUUID.result_processorE   s#     << N Nr-    N)r3   r   r4   objectr0   z#Optional[_ResultProcessorType[Any]])__name__
__module____qualname____firstlineno__r5   __static_attributes__r7   r-   r*   r   r   A   s    )/	,r-   r   c                  Z   ^  \ rS rSr% SrS\S'   S
S jrS
S jrSU 4S jjrSS jr	S	r
U =r$ )&MySQLExecutionContext_mariadbconnector^   NzOptional[int]
_lastrowidc                4    U R                   R                  SS9$ )NFbuffered_dbapi_connectioncursorr2   s    r*   create_server_side_cursor@MySQLExecutionContext_mariadbconnector.create_server_side_cursora   s    %%,,e,<<r-   c                4    U R                   R                  SS9$ )NTrC   rE   rH   s    r*   create_default_cursor<MySQLExecutionContext_mariadbconnector.create_default_cursord   s    %%,,d,;;r-   c                B  > [         TU ]  5         U R                  R                  U l        [
        (       a!  [        U R                  [        5      (       d   eU R                  (       a8  U R                  R                  (       a  U R                  R                  U l        g g g N)super	post_execrG   rowcount	_rowcountr   
isinstancecompiledr   isinsertpostfetch_lastrowid	lastrowidrA   )r2   	__class__s    r*   rQ   0MySQLExecutionContext_mariadbconnector.post_execg   sf    --=dmm[9999==T]]>>"kk33DO ?=r-   c                N    [         (       a  U R                  c   eU R                  $ rO   )r   rA   rH   s    r*   get_lastrowid4MySQLExecutionContext_mariadbconnector.get_lastrowidq   s!    =??...r-   )rA   rS   )r0   r   )r0   None)r0   int)r9   r:   r;   r<   rA   __annotations__rI   rL   rQ   r\   r=   __classcell__rY   s   @r*   r?   r?   ^   s&     $J$=<4 r-   r?   c                      \ rS rSrSrg)MySQLCompiler_mariadbconnectorw   r7   N)r9   r:   r;   r<   r=   r7   r-   r*   rd   rd   w   s    r-   rd   c                    ^  \ 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S j5       rSU 4S jjr\SS j5       r        SU 4S	 jjrSS
 jrSS jr SS jr!    SS jr"SS jr#      SU 4S jjr$SS jr%SS jr&  S          S!S jjr'  S          S!S jjr(Sr)U =r*$ )"MySQLDialect_mariadbconnector{   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   rn   rn   )dbapir&   tuplerefindallrm   r_   )r2   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 )Nrk   z?The minimum required version for MariaDB Connector/Python is %s.c              3  8   #    U  H  n[        U5      v   M     g 7frO   )r/   ).0rs   s     r*   	<genexpr>9MySQLDialect_mariadbconnector.__init__.<locals>.<genexpr>   s     K/J!s1vv/Js   r7   )rP   __init__
paramstylero   rt   mariadb_cpy_minimum_versionNotImplementedErrorjoin)r2   kwargsrY   s     r*   r|   &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)rP   is_disconnectrT   loaded_dbapiErrorr/   lower)r2   e
connectionrG   str_erY   s        r*   r   +MySQLDialect_mariadbconnector.is_disconnect   sX     7 77,,2233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$ ! [        [        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getro   r   r9   	constantsCLIENT
FOUND_ROWSAttributeErrorImportErrorsupports_sane_rowcount)r2   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 #.4x #K0 4.3+4s   AC( (DDc                4     UR                   nU$ !   Sn U$ = f)N)errno)r2   	exceptionrcs      r*   _extract_error_code1MySQLDialect_mariadbconnector._extract_error_code   s(    	ooB 		B	s    c                    g)Nrj   r7   )r2   r   s     r*   _detect_charset-MySQLDialect_mariadbconnector._detect_charset   s    r-   c                    g)N)SERIALIZABLEzREAD UNCOMMITTEDzREAD COMMITTEDzREPEATABLE READ
AUTOCOMMITr7   r2   
dbapi_conns     r*   get_isolation_level_values8MySQLDialect_mariadbconnector.get_isolation_level_values   s    
r-   c                ,    [        UR                  5      $ rO   )r   
autocommitr   s     r*   detect_autocommit_setting7MySQLDialect_mariadbconnector.detect_autocommit_setting   s    J))**r-   c                N   > US:X  a  SUl         g SUl         [        TU ]	  X5        g )Nr   TF)r   rP   set_isolation_level)r2   dbapi_connectionlevelrY   s      r*   r   1MySQLDialect_mariadbconnector.set_isolation_level  s-     L *.'*/'G'(8@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r2   r   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   r2   r   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_twophase2  sK     $$Z5HH%&11eS$?	
r-   )r}   r   )r0   zTuple[int, ...])r   r   r0   r^   )r0   r   )r   DBAPIModule.Errorr   z7Optional[Union[PoolProxiedConnection, DBAPIConnection]]rG   zOptional[DBAPICursor]r0   r   )r   r   r0   r   )r   r   r0   r_   )r   r   r0   r/   )r   r   r0   zSequence[IsolationLevel])r   r   r0   r   )r   r   r   r   r0   r^   )r   r   r   r   r0   r^   )TF)
r   r   r   r   r   r   r   r   r0   r^   )+r9   r:   r;   r<   driversupports_statement_cachesupports_unicode_statementsencodingconvert_unicoder   supports_sane_multi_rowcountsupports_native_decimaldefault_paramstyler?   execution_ctx_clsrd   statement_compilersupports_server_side_cursorsr   update_copyr   colspecsr   Uuidr   memoized_propertyrt   r|   classmethodr   r   r   r   r   r   r   r   r   r   r   r   r=   ra   rb   s   @r*   rg   rg   {   s   F# #'HO!#' " >7#' |<H 
   	 % % L &	
 
%N	
)	
	!	
+A /A8FA	A


  !

 
 	

 
 

. !

 
 	

 
 

 
r-   rg   )-__doc__
__future__r   rq   typingr   r   r   r   r   r	   uuidr
   r'   baser   r   r    r   r   r   engine.baser   engine.interfacesr   r   r   r   r   r   r   
engine.urlr   sql.compilerr   sql.type_apir   r~   _UUID_RETURNr   r?   rd   rg   r3   r7   r-   r*   <module>r     s   , # 	        %   '   )4400,3:!+4 ( 8==!6!67 :-B 2	] 	D
L D
N (r-   