8}xdZddlZddlmZddlmZddlmZddlmZdd lm Z Gd d ej Z Gd d eZ GddeZ e ZdS)aK .. dialect:: mssql+pymssql :name: pymssql :dbapi: pymssql :connectstring: mssql+pymssql://:@/?charset=utf8 pymssql is a Python module that provides a Python DBAPI interface around `FreeTDS `_. .. note:: pymssql is currently not included in SQLAlchemy's continuous integration (CI) testing. Modern versions of this driver worked very well with SQL Server and FreeTDS from Linux and were highly recommended. However, pymssql is currently unmaintained and has fallen behind the progress of the Microsoft ODBC driver in its support for newer features of SQL Server. The latest official release of pymssql at the time of this document is version 2.1.4 (August, 2018) and it lacks support for: 1. table-valued parameters (TVPs), 2. ``datetimeoffset`` columns using timezone-aware ``datetime`` objects (values are sent and retrieved as strings), and 3. encrypted connections (e.g., to Azure SQL), when pymssql is installed from the pre-built wheels. Support for encrypted connections requires building pymssql from source, which can be a nuisance, especially under Windows. The above features are all supported by mssql+pyodbc when using Microsoft's ODBC Driver for SQL Server (msodbcsql), which is now available for Windows, (several flavors of) Linux, and macOS. N) MSDialect)MSIdentifierPreparer) processors)types)utilceZdZdZdS)_MSNumeric_pymssqlcj|js tjStj|||SN) asdecimalrto_floatsqltypesNumericresult_processor)selfdialecttype_s u/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/mssql/pymssql.pyrz#_MSNumeric_pymssql.result_processor4s1~ K& &#44T7EJJ JN)__name__ __module__ __qualname__rrrr r 3s(KKKKKrr ceZdZfdZxZS)MSIdentifierPreparer_pymssqlcftt||d|_dS)NF)superr__init___double_percents)rr __class__s rr z%MSIdentifierPreparer_pymssql.__init__<s2 *D11::7CCC!&r)rrrr __classcell__r"s@rrr;s8&&&&&&&&&rrceZdZdZdZeZeje j e j e e je jiZ edZdZdZdZfdZxZS)MSDialect_pymssqlTpymssqlctd}td|jdD}|dkrd|_|dkrt jd|S)Nr'c34K|]}t|VdSr int.0xs r z*MSDialect_pymssql.dbapi..Rs(IIa3q66IIIIIIr.)rrcDt|dr|nt|S)Ndecode)hasattrstr)r.s rz)MSDialect_pymssql.dbapi..Us71h+?+?&KaaSVVr)rzIThe pymssql dialect expects at least the 1.0 series of the pymssql DBAPI.) __import__tuple __version__splitBinaryr warn)clsmodule client_vers rdbapizMSDialect_pymssql.dbapiNs|I&&II6+=+C+CC+H+HIIIII  ! !KKFM    I7    rc |d}tjd|}|r/td|ddddDSdS)Nzselect @@versionz'Microsoft .*? - (\d+).(\d+).(\d+).(\d+)c34K|]}t|VdSr r*r,s rr/z=MSDialect_pymssql._get_server_version_info..bs(==AQ======rrr1r)scalarrematchr8group)r connectionversms r_get_server_version_infoz*MSDialect_pymssql._get_server_version_info^sd  !344 H? F F  ==Aq!)<)<===== =4rc|d}||j|dd}|rd|vr|dd||d<g|gS)Nuser)usernameporthost:)translate_connect_argsupdatequerypop)rurloptsrOs rcreate_connect_argsz%MSDialect_pymssql.create_connect_argsfsq))6):: CIxx%%  :FdNN&*6lllDD9DLDzrc8dD]}|t|vrdSdS)N) z$Adaptive Server connection timed outz-Net-Lib error during Connection reset by peerz message 20003z Error 10054z"Not connected to any MS SQL serverzConnection is closedz message 20006z message 20017z message 20047TF)r5)rerHcursormsgs r is_disconnectzMSDialect_pymssql.is_disconnectns7    Cc!ff}}tt5rc|dkr|ddS|dtt|||dS)N AUTOCOMMITTF) autocommitrr&set_isolation_level)rrHlevelr"s rraz%MSDialect_pymssql.set_isolation_levelsn L  ! !$ ' ' ' ' '  ! !% ( ( ( #T * * > >E     r)rrrsupports_native_decimaldriverrpreparerr update_copyrcolspecsrrr Float classmethodr@rKrXr]rar#r$s@rr&r&Cs" F+Ht  -x~x~NH   [ "rr&)__doc__rEbaserrrrrr rr rr&rrrrrms!!D &&&&&&!!!!!!KKKKK)KKK&&&&&&&CCCCC CCCL r