zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
53
54
55
56
57
58
59
60
61
62
63
64
U
¸ý°dã@s„dZddlZddlmZddlmZddlmZddlmZdd    lmZd
Z    Gd d „d eƒZ
Gd d„deƒZ Gdd„deƒZ e Z dS)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é)Ú MySQLCompiler)Ú MySQLDialect)ÚMySQLExecutionContexté)Úsql)Úutil)rrrc@s0eZdZdZdd„Zdd„Zdd„Zdd    „ZdS)
Ú&MySQLExecutionContext_mariadbconnectorNcCs|jjddS)NF©Zbuffered©Z_dbapi_connectionÚcursor©Úself©rúad:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/dialects/mysql/mariadbconnector.pyÚcreate_server_side_cursor.sz@MySQLExecutionContext_mariadbconnector.create_server_side_cursorcCs|jjddS)NTr
r r rrrÚcreate_default_cursor1sz<MySQLExecutionContext_mariadbconnector.create_default_cursorcCs|jr|jjr|jj|_dS©N)ZisinsertZcompiledZpostfetch_lastrowidr Z    lastrowidÚ
_lastrowidr rrrÚ    post_exec4sz0MySQLExecutionContext_mariadbconnector.post_execcCs|jSr)rr rrrÚ get_lastrowid8sz4MySQLExecutionContext_mariadbconnector.get_lastrowid)Ú__name__Ú
__module__Ú __qualname__rrrrrrrrrr    +s
r    c@s eZdZdS)ÚMySQLCompiler_mariadbconnectorN)rrrrrrrr<srcsÂeZdZdZdZdZdZdZdZdZ    dZ
dZ e Z eZdZejdd„ƒZ‡fdd„Zed    d
„ƒZ‡fd d „Zd d„Zdd„Zdd„Zdd„Z‡fdd„Zdd„Zdd„Zd dd„Zd!dd„Z ‡Z!S)"ÚMySQLDialect_mariadbconnectorZmariadbconnectorTÚutf8mb4ÚqmarkcCs8|jr0t|jdƒr0tdd„t d|jj¡DƒƒSdSdS)NÚ __version__cSsg|] }t|ƒ‘qSr)Úint©Ú.0ÚxrrrÚ
<listcomp>^sÿz@MySQLDialect_mariadbconnector._dbapi_version.<locals>.<listcomp>z(\d+)(?:[-\.]?|$))écr$r$)ÚdbapiÚhasattrÚtupleÚreÚfindallrr rrrÚ_dbapi_versionZsÿþÿ    z,MySQLDialect_mariadbconnector._dbapi_versionc sHtƒjf|Žd|_|jdk    rD|jtkrDtdd dd„tDƒ¡ƒ‚dS)Nrz?The minimum required version for MariaDB Connector/Python is %sÚ.css|]}t|ƒVqdSr)Ústrr rrrÚ    <genexpr>psz9MySQLDialect_mariadbconnector.__init__.<locals>.<genexpr>)ÚsuperÚ__init__Z
paramstyler%r*Úmariadb_cpy_minimum_versionÚNotImplementedErrorÚjoin)rÚkwargs©Ú    __class__rrr/hs
 
þÿz&MySQLDialect_mariadbconnector.__init__cCstdƒS)NZmariadb)Ú
__import__)ÚclsrrrÚ import_dbapissz*MySQLDialect_mariadbconnector.import_dbapicsFtƒ |||¡rdSt||jjƒr>t|ƒ ¡}d|kp<d|kSdSdS)NTz not connectedz isn't validF)r.Ú is_disconnectÚ
isinstancer%ÚErrorr,Úlower)rÚeÚ
connectionr Zstr_er4rrr9ws  z+MySQLDialect_mariadbconnector.is_disconnectc    Cs¼| ¡}ddddddg}ddd    d
g}|D]}t ||t¡q(|D]}t ||t¡q@| dd ¡}|jdk    r´z"t|jjd ƒj    j
}||j O}Wnt t fk
rªd |_YnX||d<g|gS)NÚconnect_timeoutÚ read_timeoutZ write_timeoutÚ client_flagÚportZ    pool_sizeZ local_infileZssl_verify_certÚsslZpool_reset_connectionrz.constants.CLIENTF)Ztranslate_connect_argsrZcoerce_kw_typerÚboolÚgetr%r6rÚ    constantsZCLIENTZ
FOUND_ROWSÚAttributeErrorÚ ImportErrorÚsupports_sane_rowcount)rÚurlÚoptsZ
int_paramsZ bool_paramsÚkeyrAZ CLIENT_FLAGSrrrÚcreate_connect_args€s8ú    ü 
 
ÿ z1MySQLDialect_mariadbconnector.create_connect_argscCs z
|j}Wnd}YnX|S)Néÿÿÿÿ)Úerrno)rÚ    exceptionÚrcrrrÚ_extract_error_code¥s
 
 
z1MySQLDialect_mariadbconnector._extract_error_codecCsdS)Nrr)rr>rrrÚ_detect_charset¬sz-MySQLDialect_mariadbconnector._detect_charsetcCsdS)N)Z SERIALIZABLEzREAD UNCOMMITTEDzREAD COMMITTEDzREPEATABLE READÚ
AUTOCOMMITr)rZdbapi_connectionrrrÚget_isolation_level_values¯sz8MySQLDialect_mariadbconnector.get_isolation_level_valuescs(|dkrd|_nd|_tƒ ||¡dS)NrTTF)Z
autocommitr.Úset_isolation_level)rr>Úlevelr4rrrV¸sz1MySQLDialect_mariadbconnector.set_isolation_levelc    Cs&| t d¡ tjd|dd¡¡dS)Nz XA BEGIN :xidÚxidT©Zliteral_execute©ÚexecuterÚtextÚ
bindparamsÚ    bindparam©rr>rXrrrÚdo_begin_twophase¿s
 
ÿÿz/MySQLDialect_mariadbconnector.do_begin_twophasec    CsH| t d¡ tjd|dd¡¡| t d¡ tjd|dd¡¡dS)Nú XA END :xidrXTrYzXA PREPARE :xidrZr_rrrÚdo_prepare_twophaseÆs
ÿÿ
ÿÿz1MySQLDialect_mariadbconnector.do_prepare_twophaseFc    CsL|s&| t d¡ tjd|dd¡¡| t d¡ tjd|dd¡¡dS)NrarXTrYzXA ROLLBACK :xidrZ©rr>rXZ is_preparedZrecoverrrrÚdo_rollback_twophaseÒs
ÿÿ
ÿÿz2MySQLDialect_mariadbconnector.do_rollback_twophasec    Cs6|s| ||¡| t d¡ tjd|dd¡¡dS)NzXA COMMIT :xidrXTrY)rbr[rr\r]r^rcrrrÚdo_commit_twophaseás 
ÿÿz0MySQLDialect_mariadbconnector.do_commit_twophase)TF)TF)"rrrZdriverZsupports_statement_cacheZsupports_unicode_statementsÚencodingZconvert_unicoderIZsupports_sane_multi_rowcountZsupports_native_decimalZdefault_paramstyler    Zexecution_ctx_clsrZstatement_compilerZsupports_server_side_cursorsrZmemoized_propertyr*r/Ú classmethodr8r9rMrRrSrUrVr`rbrdreÚ __classcell__rrr4rr@s> 
 
     %      ÿ
ÿr)Ú__doc__r(ÚbaserrrÚrrr0r    rrÚdialectrrrrÚ<module>
s     .