HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyc
�
���ec@s�ddlmZdejfd��YZdefd��YZdeejjfd��YZdeejjfd	��YZd
S(i(ttypestJSONcBseZdZRS(s�	MSSQL JSON type.

    MSSQL supports JSON-formatted data as of SQL Server 2016.

    The :class:`_mssql.JSON` datatype at the DDL level will represent the
    datatype as ``NVARCHAR(max)``, but provides for JSON-level comparison
    functions as well as Python coercion behavior.

    :class:`_mssql.JSON` is used automatically whenever the base
    :class:`_types.JSON` datatype is used against a SQL Server backend.

    .. seealso::

        :class:`_types.JSON` - main documentation for the generic
        cross-platform JSON datatype.

    The :class:`_mssql.JSON` type supports persistence of JSON values
    as well as the core index operations provided by :class:`_types.JSON`
    datatype, by adapting the operations to render the ``JSON_VALUE``
    or ``JSON_QUERY`` functions at the database level.

    The SQL Server :class:`_mssql.JSON` type necessarily makes use of the
    ``JSON_QUERY`` and ``JSON_VALUE`` functions when querying for elements
    of a JSON object.   These two functions have a major restriction in that
    they are **mutually exclusive** based on the type of object to be returned.
    The ``JSON_QUERY`` function **only** returns a JSON dictionary or list,
    but not an individual string, numeric, or boolean element; the
    ``JSON_VALUE`` function **only** returns an individual string, numeric,
    or boolean element.   **both functions either return NULL or raise
    an error if they are not used against the correct expected value**.

    To handle this awkward requirement, indexed access rules are as follows:

    1. When extracting a sub element from a JSON that is itself a JSON
       dictionary or list, the :meth:`_types.JSON.Comparator.as_json` accessor
       should be used::

            stmt = select(
                data_table.c.data["some key"].as_json()
            ).where(
                data_table.c.data["some key"].as_json() == {"sub": "structure"}
            )

    2. When extracting a sub element from a JSON that is a plain boolean,
       string, integer, or float, use the appropriate method among
       :meth:`_types.JSON.Comparator.as_boolean`,
       :meth:`_types.JSON.Comparator.as_string`,
       :meth:`_types.JSON.Comparator.as_integer`,
       :meth:`_types.JSON.Comparator.as_float`::

            stmt = select(
                data_table.c.data["some key"].as_string()
            ).where(
                data_table.c.data["some key"].as_string() == "some string"
            )

    .. versionadded:: 1.4


    (t__name__t
__module__t__doc__(((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyRs<t_FormatTypeMixincBs#eZd�Zd�Zd�ZRS(cCs
t��dS(N(tNotImplementedError(tselftvalue((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyt
_format_valueWscs%�j|����fd�}|S(Ncs(�j|�}�r$�|�}n|S(N(R	(R(Rt
super_proc(sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pytprocess]s(tstring_bind_processor(RtdialectR((RR
sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pytbind_processorZscs%�j|����fd�}|S(Ncs(�j|�}�r$�|�}n|S(N(R	(R(RR
(sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyRhs(tstring_literal_processor(RR
R((RR
sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pytliteral_processores(RRR	RR(((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyRVs		t
JSONIndexTypecBseZd�ZRS(cCs*t|t�rd|}n
d|}|S(Ns$[%s]s$."%s"(t
isinstancetint(RR((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyR	rs

(RRR	(((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyRqstJSONPathTypecBseZd�ZRS(cCsAddjg|D])}t|t�r/d|nd|^q�S(Ns$%sts[%s]s."%s"(tjoinRR(RRtelem((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyR	{s(RRR	(((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyRzsN(RRtsqltypesRtobjectRRR(((sO/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/json.pyt<module>s
E