https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/db/models/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/db/models/sql/__pycache__/subqueries.cpython-310.pyc
o

3�ap�@s�dZddlmZddlmZddlmZmZmZddl	m
Z
gd�ZGdd�de
�ZGd	d
�d
e
�Z
Gdd�de
�ZGd
d�de
�ZdS)zR
Query subclasses which provide extra functionality beyond simple data retrieval.
�)�
FieldError)�Q)�CURSOR�GET_ITERATOR_CHUNK_SIZE�
NO_RESULTS)�Query)�DeleteQuery�UpdateQuery�InsertQuery�AggregateQueryc@s$eZdZdZdZdd�Zdd�ZdS)rzA DELETE SQL query.�SQLDeleteCompilercCsX||j|i|_||_|�|��t�}|r*|�|jWd�S1s%wYdS)Nr)�	alias_map�where�get_compiler�execute_sqlr�rowcount)�self�tabler�using�cursor�r�A/usr/lib/python3/dist-packages/django/db/models/sql/subqueries.py�do_querys �zDeleteQuery.do_querycCsxd}|��j}tdt|�t�D]*}|��|_|�tdi|j	d|||t�i���||j
|��j|j|d�7}q|S)z�
        Set up and execute delete queries for all the objects in pk_list.

        More than one physical query may be executed if there are a
        lot of values in pk_list.
        r�__in)rNr)�get_meta�pk�range�lenr�where_classr�add_qr�attnamer�db_table)r�pk_listr�num_deleted�field�offsetrrr�delete_batchs


�zDeleteQuery.delete_batchN)�__name__�
__module__�__qualname__�__doc__�compilerrr&rrrrrs
	rcs`eZdZdZdZ�fdd�Zdd�Z�fdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Z�Z
S)r	zAn UPDATE SQL query.�SQLUpdateCompilercst�j|i|��|��dS�N)�super�__init__�_setup_query)r�args�kwargs��	__class__rrr/4szUpdateQuery.__init__cCsg|_d|_i|_dS)z�
        Run on initialization and at the end of chaining. Any attributes that
        would normally be set in __init__() should go here instead.
        N)�values�related_ids�related_updates)rrrrr08s
zUpdateQuery._setup_querycst���}|j��|_|Sr-)r.�cloner7�copy)r�objr3rrr8As
zUpdateQuery.clonecCsZ|�|�tdt|�t�D]}|��|_|�t|||t�d��|�|��	t
�q
dS)Nr)�pk__in)�add_update_valuesrrrrrrrrrr)rr"r5rr%rrr�update_batchFs

�zUpdateQuery.update_batchcCs�g}|��D]A\}}|���|�}|jo|jp|j}|jjj}|r*|jr0|j	r0t
d|��||��jur?|�|||�q|�|||f�q|�
|�S)z�
        Convert a dictionary of field name to value mappings into an update
        query. This is the entry point for the public update() method on
        querysets.
        zMCannot update model field %r (only non-relations and foreign keys permitted).)�itemsr�	get_field�auto_created�concrete�model�_meta�concrete_model�is_relation�many_to_manyr�add_related_update�append�add_update_fields)rr5�
values_seq�name�valr$�directrBrrrr<Ms 
��
zUpdateQuery.add_update_valuescCs@|D]\}}}t|d�r|j|ddd�}|j�|||f�qdS)z�
        Append a sequence of (field, model, value) triples to the internal list
        that will be used to generate the UPDATE query. Might be more usefully
        called add_update_targets() to hint at the extra information here.
        �resolve_expressionFT)�allow_joins�for_saveN)�hasattrrNr5rH)rrJr$rBrLrrrrIcs

�zUpdateQuery.add_update_fieldscCs|j�|g��|d|f�dS)z�
        Add (name, value) to an update query for an ancestor model.

        Update are coalesced so that only one update query per ancestor is run.
        N)r7�
setdefaultrH)rrBr$�valuerrrrGoszUpdateQuery.add_related_updatecCsX|jsgSg}|j��D]\}}t|�}||_|jdur$|�d|jf�|�|�q|S)z�
        Return a list of query objects: one for each update required to an
        ancestor model. Each query will have the same filtering conditions as
        the current query but will only update a single table.
        Nr;)r7r>r	r5r6�
add_filterrH)r�resultrBr5�queryrrr�get_related_updatesws
zUpdateQuery.get_related_updates)r'r(r)r*r+r/r0r8r=r<rIrGrW�
__classcell__rrr3rr	/s	r	cs0eZdZdZdd��fdd�
Zddd�Z�ZS)	r
�SQLInsertCompilerF)�ignore_conflictscs(t�j|i|��g|_g|_||_dSr-)r.r/�fields�objsrZ)rrZr1r2r3rrr/�s
zInsertQuery.__init__cCs||_||_||_dSr-)r[r\�raw)rr[r\r]rrr�
insert_values�s
zInsertQuery.insert_values)F)r'r(r)r+r/r^rXrrr3rr
�sr
cs$eZdZdZdZ�fdd�Z�ZS)rzu
    Take another query as a parameter to the FROM clause and only select the
    elements in the provided list.
    �SQLAggregateCompilercs||_t��|�dSr-)�inner_queryr.r/)rrBr`r3rrr/�szAggregateQuery.__init__)r'r(r)r*r+r/rXrrr3rr�srN)r*�django.core.exceptionsr�django.db.models.query_utilsr�django.db.models.sql.constantsrrr�django.db.models.sql.queryr�__all__rr	r
rrrrr�<module>s Z

https://t.me/RX1948 - 2025