§
    ùyIfÀ  ã                  óÂ   — d dl mZ d dlZd dlZd dlZd dlmZ d dlZ	d dl
mZ d dlmZ d dlmZ d dlmZ dd	„Zej         G d
„ d¦  «        ¦   «         Zdd„Zdd„Zdd„ZdS )é    )ÚannotationsN)Úperf_counter)Úcurrent_app)Úg)Úhas_app_contextÚreturnúlist[_QueryInfo]c                 ó,   — t          j        dg ¦  «        S )a’  Get the list of recorded query information for the current session. Queries are
    recorded if the config :data:`.SQLALCHEMY_RECORD_QUERIES` is enabled.

    Each query info object has the following attributes:

    ``statement``
        The string of SQL generated by SQLAlchemy with parameter placeholders.
    ``parameters``
        The parameters sent with the SQL statement.
    ``start_time`` / ``end_time``
        Timing info about when the query started execution and when the results where
        returned. Accuracy and value depends on the operating system.
    ``duration``
        The time the query took in seconds.
    ``location``
        A string description of where in your application code the query was executed.
        This may not be possible to calculate, and the format is not stable.

    .. versionchanged:: 3.0
        Renamed from ``get_debug_queries``.

    .. versionchanged:: 3.0
        The info object is a dataclass instead of a tuple.

    .. versionchanged:: 3.0
        The info object attribute ``context`` is renamed to ``location``.

    .. versionchanged:: 3.0
        Not enabled automatically in debug or testing mode.
    Ú_sqlalchemy_queries)r   Úget© ó    úS/var/www/piapp/venv/lib/python3.11/site-packages/flask_sqlalchemy/record_queries.pyÚget_recorded_queriesr      s   € õ> Œ5Ð&¨Ñ+Ô+Ð+r   c                  ó^   — e Zd ZU dZded<   ded<   ded<   ded<   d	ed
<   edd„¦   «         ZdS )Ú
_QueryInfoa8  Information about an executed query. Returned by :func:`get_recorded_queries`.

    .. versionchanged:: 3.0
        Renamed from ``_DebugQueryTuple``.

    .. versionchanged:: 3.0
        Changed to a dataclass instead of a tuple.

    .. versionchanged:: 3.0
        ``context`` is renamed to ``location``.
    z
str | NoneÚ	statementút.AnyÚ
parametersÚfloatÚ
start_timeÚend_timeÚstrÚlocationr   c                ó    — | j         | j        z
  S ©N)r   r   )Úselfs    r   Údurationz_QueryInfo.durationE   s   € àŒ}˜tœÑ.Ð.r   N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__Úpropertyr   r   r   r   r   r   1   sv   € € € € € € ð
ð 
ð ÐÐÑØÐÐÑØÐÐÑØ€O€O�OØ€M€M�Màð/ð /ð /ñ „Xð/ð /ð /r   r   Úengineúsa.engine.EngineÚNonec                óz   — t          j        | dt          d¬¦  «         t          j        | dt          d¬¦  «         d S )NÚbefore_cursor_executeT)ÚnamedÚafter_cursor_execute)Úsa_eventÚlistenÚ_record_startÚ_record_end)r%   s    r   Ú_listenr0   J   s<   € Ý„O�FÐ3µ]È$ÐOÑOÔOÐOÝ„O�FÐ2µKÀtÐLÑLÔLÐLÐLÐLr   Úcontextúsa.engine.ExecutionContextÚkwargsr   c                óL   — t          ¦   «         sd S t          ¦   «         | _        d S r   )r   r   Ú_fsa_start_time)r1   r3   s     r   r.   r.   O   s'   € ÝÑÔð Øˆå*™nœn€GÔÐÐr   c           	     ó.  — t          ¦   «         sd S dt          vrg t          _        t          j                             d¦  «        d         }|› d�}t          j        ¦   «         }|rb|j         	                    d¦  «        }|r=||k    s| 
                    |¦  «        r"|j        }|j        › d|j        › d|j        › d�}n|j        }|°bd}t          j                             t#          | j        | j        | j        t+          ¦   «         |¬	¦  «        ¦  «         d S )
Nr   ú.r   r   ú:z (ú)z	<unknown>)r   r   r   r   r   )r   r   r   r   Úimport_nameÚ	partitionÚinspectÚcurrentframeÚ	f_globalsr   Ú
startswithÚf_codeÚco_filenameÚf_linenoÚco_nameÚf_backÚappendr   r   r   r5   r   )r1   r3   Ú
import_topÚ
import_dotÚframeÚnameÚcoder   s           r   r/   r/   V   s9  € ÝÑÔð Øˆà¥AÐ%Ð%Ø "�ÔåÔ(×2Ò2°3Ñ7Ô7¸Ô:€JØÐ!Ð!Ð!€JÝÔ Ñ"Ô"€Eà
ð 
ØŒ×"Ò" :Ñ.Ô.ˆàð 	�T˜ZÒ'Ð'¨4¯?ª?¸:Ñ+FÔ+FÐ'Ø”<ˆDØÔ*ÐNÐN¨U¬^ÐNÐN¸t¼|ÐNÐNÐNˆHØà”ˆð ð 
ð ˆåÔ× Ò ÝØÔ'ØÔ)ØÔ.Ý!‘^”^Øð	
ñ 	
ô 	
ñô ð ð ð r   )r   r	   )r%   r&   r   r'   )r1   r2   r3   r   r   r'   )Ú
__future__r   Údataclassesr<   ÚtypingÚtÚtimer   Ú
sqlalchemyÚsaÚsqlalchemy.eventÚeventr,   Úflaskr   r   r   r   Ú	dataclassr   r0   r.   r/   r   r   r   ú<module>rV      s5  ðØ "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !ð,ð ,ð ,ð ,ðD Ôð/ð /ð /ð /ð /ñ /ô /ñ Ôð/ð0Mð Mð Mð Mð
-ð -ð -ð -ðð ð ð ð ð r   