https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/db/models/sql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/db/models/sql/compiler.pyc
�
r�\c@s�ddlZddlmZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
mZmZmZmZddlmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZddlm Z ddlm!Z!de"fd��YZ#de#fd��YZ$de#fd��YZ%de#fd��YZ&de#fd��YZ'de#fd��YZ(de#fd��YZ)d�Z*dS(i����N(tsettings(t
FieldError(t
truncate_name(t
LOOKUP_SEP(tselect_related_descendtQueryWrapper(tSINGLEtMULTIt	ORDER_DIRtGET_ITERATOR_CHUNK_SIZEt
SelectInfo(tEmptyResultSet(tSQLEvaluator(t
get_order_dirtQuery(tTransactionManagementError(t
DatabaseError(tsix(tzip(ttimezonetSQLCompilercBs�eZd�Zd�Zd�Zeed�Zd�Zed�Z	edddedd�Zd�Zd�Z
dd	dd
�Zd�Zd�Zd
�Zd�Zddddddd�Zd�Zd�Zed�Zd�ZRS(cCs:||_||_||_i|_g|_g|_dS(N(tqueryt
connectiontusingtquote_cachetordering_aliasestordering_params(tselfRRR((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyt__init__s					cCs�|jjs4|jjd|jj�jdf�n|jjrj|jjrj|jjrj|jj	�n|jj
r�|jjr�|j�ndS(sr
        Does any necessary class setup immediately prior to producing SQL. This
        is for things that can't necessarily be done in __init__ because we
        might not have all the pieces in place at that time.
        # TODO: after the query has been executed, the altered state should be
        # cleaned. We are not using a clone() of the query here.
        N(
RttablestjointNonetget_metatdb_tabletselecttdefault_colstincluded_inherited_modelstsetup_inherited_modelstselect_relatedtrelated_select_colstfill_related_selections(R((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyt
pre_sql_setup!s(
cCs�||jkr|j|S||jjkr>||jjksP||jjkra||j|<|S|jjj|�}||j|<|S(s�
        A wrapper around connection.ops.quote_name that doesn't quote aliases
        for table names. This avoids problems with some SQL dialects that treat
        quoted strings specially (e.g. PostgreSQL).
        (RRt	alias_mapt	table_maptextra_selectRtopst
quote_name(Rtnametr((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pytquote_name_unless_alias1s$

cCs|r(|jj|jjkr(ddfS|j�|jjj�|_|j|�\}}|j�\}}}|j	�}|j
�\}	}
|j}|jjj
d|d|j�\}}
|jjj
d|d|j�\}}|jjj�}g}x.tj|jj�D]}|j|d�qWdg}|jjrc|j|jjj|��n|j|�|jdj||j��|j|�|j|j�|jd�|j|	�|j|
�|r�|jd|�|j|
�n|j||�\}}|rp|r+td	��n|sF|jjj�}n|jd
dj|��|j|�n|r�|jd|�|j|�n|r�|jddj|��n|r`|jjdk	r�|jd
|jj|jj�n|jjr`|jjdkrC|jjj �}|rC|jd
|�qCn|jd|jj�q`n|jj!r�|jj"j#r�|jj$�r�t%d��n|jj&}|r�|jj"j'r�t(d��n|j|jjj)d|��n|jj*|j�dj|�t+|�fS(s�
        Creates the SQL for this query. Returns the SQL string and list of
        parameters.

        If 'with_limits' is False, any limit/offset information is not included
        in the query.
        ttqnRitSELECTs, tFROMsWHERE %ss.annotate() + distinct(fields) not implemented.sGROUP BY %ss	HAVING %ssORDER BY %ssLIMIT %ds	OFFSET %ds:select_for_update cannot be used outside of a transaction.s1NOWAIT is not supported on this database backend.tnowaitt (N(,Rtlow_markt	high_markR)talias_refcounttcopytrefcounts_beforetget_columnstget_orderingtget_distincttget_from_clauseR1twheretas_sqlRthavingtget_colsRt
itervaluesR,textendtdistincttappendR-tdistinct_sqlRRRtget_groupingtNotImplementedErrortforce_no_orderingRtno_limit_valuetselect_for_updatetfeaturesthas_select_for_updatetget_autocommitRtselect_for_update_nowaitthas_select_for_update_nowaitRtfor_update_sqltreset_refcountsttuple(Rtwith_limitstwith_col_aliasestout_colsts_paramstorderingto_paramstordering_group_bytdistinct_fieldstfrom_tf_paramsR3RAtw_paramsRCth_paramsthaving_group_bytparamstvaltresulttgroupingt	gb_paramsR6((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRBAsx

	''	




$"cCs`|jj�}|jdkr=|jdkr=|jt�n|j�|jd|j	�j
�S(sV
        Perform the same functionality as the as_sql() method, returning an
        SQL string and parameters. However, the alias prefixes are bumped
        beforehand (in a copy -- the current query isn't changed), and any
        ordering is removed if the query is unsliced.

        Used when nesting this query inside another.
        iRN(RtcloneR8R9Rtclear_orderingtTruetbump_prefixtget_compilerRRB(Rtobj((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyt
as_nested_sql�s
	
cCs |j}|jjj}gtj|jj�D]&\}}d|d||�f^q.}g}t|jjj	��}|r�|j
�}	n	t�}	|jjrq|j�}
x|jjD]�\}}t
|ttf�r|\}}|jj|j}
|
|
kr||
|
krq�nd||�||�f}|r�|d|	kr�dt|	�}|jd||f�|j|�|	j|�q|jd|||d�f�|j|�|	j|d�qj|j|�|j|�|	j|d�q�|j||j�\}}|j|�|j|�t|d�r�|j|j�|	j|j�q�q�WnA|jjr�|j||	�\}}|j|�|j|�n|jjj�}x�|jjj�D]v\}}|j||j�\}}|dkr|j|�n&|jd||t ||��f�|j|�q�Wx�|jj!D]�\\}
}}d||
�||�f}|r�||	kr�dt|	�}|jd||f�|j|�|	j|�q^|j|�|j|�|	j|�q^W||_"||fS(	s�
        Returns the list of columns to use in the select statement, as well as
        a list any extra parameters that need to be included. If no columns
        have been specified, returns all columns relating to fields in the
        model.

        If 'with_aliases' is true, any column names that are duplicated
        (without the table names) are given unique aliases. This is needed in
        some cases to avoid ambiguity with nested queries.
        s
(%s) AS %sis%s.%sisCol%ds%s AS %staliasN(#R1RR-R.Rt	iteritemsRR,tsettkeysR;R"tdeferred_to_columnst
isinstancetlistRVR*t
table_nametlenRHtaddRBRFthasattrRpR#tget_default_columnstupdatetmax_name_lengthtaggregate_selecttitemsRRR't_select_aliases(Rtwith_aliasesR3tqn2RptcolRfRdtaliasestcol_aliasest	only_loadt_tcolumnttableR0tc_aliastcol_sqlt
col_paramstcolstnew_aliasesR}t	aggregatetagg_sqlt
agg_params((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR=�sv	B	
!




	
&


	c
Csg}|dkr$|jj�}n|j}|jjj}	t�}
|j�}|si|jj	�}ni|d6}x}|j
�D]o\}
}|r�|dk	r�t||�r�q�n|jj||||�}|jj
|j}||kr	|
j||kr	q�n|r5|j||
f�|
j|�q�n|r�|
j|kr�dt|�}|jd||�|	|
j�|f�|j|�|
j|�q�d||�|	|
j�f}|j|�|
j|�|r�|j|
j�q�q�W||
fS(sW
        Computes the default columns for selecting every field in the base
        model. Will sometimes be called to pull in related models (e.g. via
        select_related), in which case "opts" and "start_alias" will be given
        to provide a starting point for the traversal.

        Returns a list of strings, quoted appropriately for use in SQL
        directly, as well as a set of aliases used in the select statement (if
        'as_pairs' is True, returns a list of (alias, col_name) pairs instead
        of strings as the first component and None as the second component).
        sCol%ds%s.%s AS %ss%s.%sN(RRR R1RR-R.RrRttget_initial_aliastget_concrete_fields_with_modelt
issubclasstjoin_parent_modelR*RwR�RHRyRx(RR�R�tstart_aliastoptstas_pairstfrom_parentRfR3R�R�R�tseen_modelstfieldtmodelRpR�R�R0((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR{sD
		
!	



cCs�|j}|jjj}g}|jj�}x�|jjD]�}|jt�}|j	||d�\}}}	}
}
|j||	�\}}	x1|D])}|jd||	�||�f�q�Wq:W|S(s�
        Returns a quoted list of fields to use in DISTINCT ON part of the query.

        Note that this method can alter the tables in the query, and thus it
        must be called before get_from_clause().
        s%s.%sN(
R1RR-R.RR R^tsplitRt_setup_joinsRt_final_join_removalRH(RR3R�RfR�R/tpartsR�R�RpR�R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR?9s	$
+c
CsS|jjr|jj}n?|jjs6|jj}n$|jjpW|jj�jpWg}|j}|jjj	}|jj
}|j}g}g}g}|jjr�t
d\}	}
nt
d\}	}
t�}g}g}
xTt|�D]F\}}|dkr!|j|jjj��q�nt|t�r�|dkrL|
}|}n|	}|jd||f�|jt|�gf�q�nt||	�\}}||jjkr�|jd||�|f�q�nd|krw|jdd�\}}||f|kr0d||�|f}|j||f�|sD||krt|jd||f�|j|gf�qtq0q�t|�d|jjkrlx�|j||jj�d	|	�D]�\}}}x�|D]�}||f|kr�d||�||�f}|j||f�|r4||kr4|j|�n|jd||f�|j|gf�q�q�Wq�Wq�||�}||jjkr�d
|jj|d|f}|j|�|
j|jj|d�n/|r||kr|j|�|
j|�n|jd||f�|j|jj|�q�W||_|
|_|||fS(s�
        Returns a tuple containing a list representing the SQL elements in the
        "order by" clause, and the list of SQL elements that need to be added
        to the GROUP BY clause as a result of the ordering.

        Also sets the ordering_aliases attribute on this instance to a list of
        extra aliases needed in the select.

        Determining the ordering SQL can change the tables we need to include,
        so this should be run *before* get_from_clause().
        tASCtDESCt?is%s %st.is%s.%st
default_orders
(%s) AS %s(Rtextra_order_bytdefault_orderingtorder_byR R[R1RR-R.RGR�tstandard_orderingRRrt	enumerateRHtrandom_function_sqlRutinttstrR
R~R�Rytextratfind_ordering_nameR,RFRR(RR[R3R�RGtselect_aliasesRftgroup_byRtasctdesctprocessed_pairsRdRtposR�torderR�R�teltR�tsql((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR>Ms�			
%
!

		R�c
Cs:t||�\}}|jt�}|j|||�\}}	}}
}|jrt|
�dkr|jr|s~t�}ntg|
D]}|j	j
|j^q��}||kr�td��n|j
|�g}
x3|jD](}|
j|j|||||��q�W|
S|j|	|�\}	}||	|fgS(s�
        Returns the table alias (the name might be ambiguous, the alias will
        not be) and column name for ordering by the given 'name' parameter.
        The 'name' is of the form 'field1__field2__...__fieldN'.
        is!Infinite loop caused by ordering.(R
R�RR�trelRxR[RrRVRR*RwRRyRFR�R�(RR/R�RpR�talready_seenR�tpiecesR�R�tjoinstjt
join_tupletresultstitem((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR��s"$$,
cCs�|s|jj�}n|jj|||�\}}}}}g|D]"}|jj|dkrF|^qF}	|d}g|D]}
|
j^q}|js�|jj|�n|jj|	�|||||fS(s�
        A helper method for get_ordering and get_distinct. This method will
        call query.setup_joins, handle refcounts and then promote the joins.

        Note that get_ordering and get_distinct must produce same target
        columns on same input, as the prefixes of get_ordering and get_distinct
        must match. Executing SQL where this is not true is an error.
        ii����(RR�tsetup_joinsR:R�R�t	ref_aliast
promote_joins(RR�R�RpR�ttargetsR�R�R�tjoins_to_promotettargetR�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR��s		/
	c	Cs�|r�x�|jj|}tg|jD]\}}||f^q&�\}}t|�t|�kriPng|D]}||j|�^qp}|jj|�|j}q	n||fS(sT
        A helper method for get_distinct and get_ordering. This method will
        trim extra not-needed joins from the tail of the join chain.

        This is very similar to what is done in trim_joins, but we will
        trim LEFT JOINS here. It would be a good idea to consolidate this
        method and query.trim_joins().
        (RR*Rt	join_colsRrtindextunref_aliast	lhs_alias(	RR�RpRtlhs_coltrhs_coltlhs_colstrhs_colsR�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR��s	4&c
Cs�g}|j}|jjj}t}g}x�|jjD]�}|jj|sSq7ny)|jj|\}}}}	}
}}Wnt	k
r�q7nX||kr�dnd|}
|r�|r�|j
|jj||	�}|r|j||j�\}}d|}|j
|�nd}|jd|||�|
f�xqt|
�D]c\}\}}|dkrs|jd�n|jd||	�||�||�||�f�qEW|jd|�n2|r�dnd	}|jd
|||�|
f�t}q7Wx�|jjD]~}|jj|�\}}||jjksO|jj|dkr	|r[dnd	}|jd|||�f�t}q	q	W||fS(
s�
        Returns a list of strings that are joined together to go after the
        "FROM" part of the query, as well as a list any extra parameters that
        need to be included. Sub-classes, can override this to create a
        from-clause via a "select".

        This should only be called after any SQL construction methods that
        might change the tables we need. This means the select columns,
        ordering and distinct must be done first.
        R2s %ssAND (%s)s%s %s%s ON (is AND s
%s.%s = %s.%ss%s)s, s%s%s%sis%s%s(R1RR-R.RkRRR:R*tKeyErrortget_extra_restrictiontwhere_classRBRFRHR�tFalsetextra_tablesttable_alias(RRfR3R�tfirsttfrom_paramsRpR/t	join_typetlhsR�R�t
join_fieldt	alias_strt
extra_condt	extra_sqltextra_paramsR�R�R�t	connectortttunused((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR@�sP	)


		0 
(
cCsv|j}gg}}|jjdk	rl|jj|jj}g|D]}|d^qE}t|jj�j�t|jj�kr�|j	j
jr�|jj�j|jj�j
jfg|j_g}nt�}|jj||}	x�|	D]�}
d}t|
ttf�r9d||
d�||
d�f}n=t|
d�rf|
j||j	�\}}ndt|
�}||kr�|j|�|j|�|j|�q�q�W|r|j	j
jrxS|D]H\}
}|
|ks�|r�|j|
�|j|�|j|
�q�q�WnxM|jjj�D]6\}}dt|�}|j|�|j|�q/Wn||fS(sY
        Returns a tuple representing the SQL elements in the "group by" clause.
        is%s.%siRBs(%s)N((R1RR�RR"R'RxR tconcrete_fieldsRROtallows_group_by_pkR!tpkR�RrRuRvRVRzRBR�RHRFRyR,tvalues(RRcR]R3RfRdtselect_colststseenR�R�R�R�R�torder_paramsR,R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRJ8sB	
*0		
'




ic
Cs]|r)|jjr)||jjkr)dS|s\|jj�}|jj�}g|j_n|jj�}|dkr�t|jjt	�r�|jj}t
}q�t}nx?|j�D]1\}}	|	p�|j
}
t||||j|
��s�q�n|p|j}|jj|jg||d|�\}}}}
}|
d}|jd|d|jjjdt
�\}}|jjjd�|D��|r�|j|ji�}nt}|jp�|}|j|jjj||d|||�q�W|rYg|j�D]$}|jjr�|j|j
f^q�}x-|D]"\}}	t||||j|	�d	t
�sfq0n|jj|j�g||dt
�\}}}}
}|
d}t|	|j
�r�|j
nd}|jd|d|	jdt
d
|�\}}|jjjd�|D��|j|j�i�}t
}|j|	j||d|||�q0WndS(s
        Fill in the information needed for a select_related query. The current
        depth is measured as the number of connections away from the root model
        (for example, cur_depth=1 means we are looking at models with direct
        connections to the root model).
        Ntouter_if_firsti����R�R�R�css3|])}t|d|djf|d�VqdS(iiN(R
R�(t.0R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pys	<genexpr>�sitreverseR�css3|])}t|d|djf|d�VqdS(iiN(R
R�(R�R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pys	<genexpr>�s(Rt	max_depthR R�R'tget_loaded_field_namesRRuR&tdictRkR�tget_fields_with_modelR�RtgettnullR�R/R{R�ttot_metaRFR(tget_all_related_objectsR�tuniquetrelated_query_nameR�(RR�t
root_aliast	cur_deptht	requestedt
restrictedtnullableR�tfR�tfield_modeltpromoteR�R�Rptcolumnstnexttnew_nullabletotrelated_fieldsR�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR(jsh%			*
$	-
cCs#i}|jj||jj�|S(s�
        Converts the self.deferred_loading data structure to mapping of table
        names to sets of column names which are to be loaded. Returns the
        dictionary.
        (Rtdeferred_to_datatdeferred_to_columns_cb(RR�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRt�sccs�t|d�}d}t|jj�}x_|jt�D]N}xE|D]=}|r�|jj�j|jj	t
��p}|jj}t|jj
�t|�}|t|jj�}n|r�|dkr�|jjr�g|jjD]}	|	j^q�}n'|jjr|jj�j}ng}|g|jjD]}	|	j^q/}|j�}
|
r�g|D]=}	|	j	jj|
ks�|	j|
|	j	jjkr^|	^q^}n|r�|| gtd||�D]}d^q�||}q�n|j||�}n|r|t|| �tgt|jjj�|||!�D]-\\}}
}|jj||
|j�^q4�t||�}n|VqDWq7WdS(sQ
        Returns an iterator over the results from executing this query.
        tresolve_columnsiN(RzRtboolRR~texecute_sqlRR�R�R�RrR"RxR,R�R#R R�R'RtR�R!R�trangeRRVRRtresolve_aggregateR(RRtfieldsthas_aggregate_selecttrowstrowt
loaded_fieldstaggregate_startt
aggregate_endR�R�txRpR�tvalue((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pytresults_iter�s6
0%&"+<{cs!y%|j�\}}|s$t�nWn+tk
rR|tkrKtg�SdSnX|jj���j||�|s|�S|tkr�|jr��j	�t
|j� S�j	�S|jr�t�t
|j�|jjj
�}n!t�fd�|jjj
�}|jjjst|�S|S(s�
        Run the query against the database and returns the result(s). The
        return value is a single data item if result_type is SINGLE, or an
        iterator over the results if the result_type is MULTI.

        result_type is either MULTI (use fetchmany() to retrieve all rows),
        SINGLE (only retrieve a single row), or None. In this last case, the
        cursor is returned if any query is executed, since it's used by
        subclasses such as InsertQuery). It's possible, however, that no query
        is needed, as the filters describe an empty set. In that case, None is
        returned, to avoid any unnecessary database interaction.
        Ncs
�jt�S(N(t	fetchmanyR	((tcursor(s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyt<lambda> s(RBRRtiterRRtexecuteRRtfetchoneRxtorder_modified_iterROtempty_fetchmany_valuetcan_use_chunked_readsRv(Rtresult_typeR�RdRf((Rs?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR�s0



	
	
cCs|jjj}t|�dkrZ|j�\}}d||�||d�|f|fSx�t|jj�D]\}}d||jd�||jd�f}	d||�|||�f}
|jj	j
td|	|
fg�d�qmW|j�\}}d||fS(Nis
%s.%s IN (%s)is%s.%ss%s = %stANDsEXISTS (%s)(RR-R.RxRBR�RR"R�RARyR(RRpR�R3R�R�RdR�t
select_colR�trhs((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pytas_subquery_condition)s'* !N(t__name__t
__module__RR)R1RkR�RBRoR=RR{R?R>R�R�R�R@RJR(RtRRRR"(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRs,			`	R5		_			;	2	M	
	8/tSQLInsertCompilercBs/eZd�Zd�Zd�Zed�ZRS(cOs&t|_tt|�j||�dS(N(R�t	return_idtsuperR%R(Rtargstkwargs((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR;s	cCs:|dkr|St|d�r2|j||j�SdSdS(Ntget_placeholders%s(RRzR*R(RR�Re((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pytplaceholder?s
c
Cst|jjj}|jj�}d||j�g}t|jj�}|rX|jjn	|jg}|j	ddj
g|D]}||j�^qz��|rg|jjD][}g|D]H}|j
|jjr�t||j�n|j|t�d|j�^q�^q�}}	n@g|jjD]}|jjj�g^q"}	gg}dg}td�|D��o�|jo�|jjj}
|
r�dgt|�g}n_g|	D]:}gt||�D]\}
}|j|
|�^q�^q�}|jjj||�}|jr�|jjjr�|d}d||j�||jj�f}|j	d	dj
|d��|jjj�\}}|r�|j	||�||7}nd
j
|�t|�fgS|
r'|j	|jjj |t|	���d
j
|�tg|	D]}|D]}|^qq�fgSgt||�D]5\}}d
j
|d	dj
|�g�|f^q7SdS(NsINSERT INTO %ss(%s)s, Rcss|]}t|d�VqdS(R*N(Rz(R�R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pys	<genexpr>bss%sis%s.%ssVALUES (%s)R7(!RR-R.RR R!RRR�RHRR�tobjstget_db_prep_savetrawtgetattrtattnametpre_saveRktpk_default_valueRtanyR&ROthas_bulk_insertRxRR+tmodify_insert_paramstcan_return_id_from_inserttreturn_insert_idRVtbulk_insert_sql(RR3R�Rft
has_fieldsRR�RnRdR�tcan_bulktplaceholdersReR�tvR�tr_fmttr_paramstptvals((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRBKsB6r.		D
%
%<cCs�|ot|jj�dks%t�||_|jj�}x*|j�D]\}}|j||�qJW|os|szdS|jj	j
r�|jjj|�S|jjj
||jj�j|jj�jj�S(Ni(RxRR,tAssertionErrorR&RRRBRROR6R-tfetch_returned_insert_idtlast_insert_idR R!R�R�(RR&RR�Rd((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR�s%	(R#R$RR+RBR�R(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR%9s			7tSQLDeleteCompilercBseZd�ZRS(cCs�t|jj�dks$td��|j}d||jjd�g}|jjjd|d|j�\}}|r�|jd|�ndj	|�t
|�fS(	sh
        Creates the SQL for this query. Returns the SQL string and list of
        parameters.
        is)Can only delete from one table at a time.sDELETE FROM %siR3RsWHERE %sR7(RxRRRAR1RARBRRHRRV(RR3RfRARd((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRB�s		'(R#R$RB(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRD�stSQLUpdateCompilercBs#eZd�Zd�Zd�ZRS(cCsJ|j�|jjs ddfS|jjd}|j}d||�g}|jd�gg}}x]|jjD]O\}}}t|d�r�|j|�}n|j|d|j	�}t|d�r�|j
||j	�}	nd}	t|d	�rt||jd
t�}n|j
}
t|d�rr|j||j	�\}}|jd||
�|f�|j|�qs|dk	r�|jd||
�|	f�|j|�qs|jd
||
��qsW|s�ddfS|jdj|��|jjjd|d|j	�\}
}|
r-|jd|
�ndj|�t||�fS(sh
        Creates the SQL for this query. Returns the SQL string and list of
        parameters.
        R2is	UPDATE %stSETtprepare_database_saveRR*s%stevaluatetallow_joinsRBs%s = %ss	%s = NULLs, R3sWHERE %sR7(N((R)RR�RR1RHRzRGR-RR*RR�R�RBRFRRRARV(RR�R3RfR�t
update_paramsR�R�ReR+R/R�RdRA((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRB�sB

	

	
'cCs�tt|�j|�}|r'|jnd}|dk}~xG|jj�D]6}|j|j�j|�}|rL|}t	}qLqLW|S(s
        Execute the specified update. Returns the number of rows affected by
        the primary update query. The "primary update query" is the first
        non-empty query that is executed. Row counts for any subsequent,
        related queries are not available.
        iN(
R'RERtrowcountRRtget_related_updatesRmRR�(RRRR
tis_emptyRtaux_rows((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR�s
c
Cs�t|j_|jjt�tt|�j�|jj�}|jj	r[|dkr[dS|jj
dt�}|j�i|_
g|_|j|j�jjg�|j�}|jj	r�|dkr�dS|dko�|jjj}|jj�|j_|jj	s|r�g}xG|j|j�jt�D]*}|jg|D]}|d^qI�q6W|jjd|f�||j_n|jjd|f�x(|jjdD]}d|jj |<q�WdS(s�
        If the update depends on results from other tables, we need to do some
        munging of the "where" conditions to match the format required for
        (portable) SQL updates. That is done here.

        Further, if we are going to be running multiple updates, we pull out
        the id values to update at this point so that they don't change as a
        result of the progressive updates.
        iNtklassitpk__in(!R�RR&RjRkR'RER)tcount_active_tablestrelated_updatesRiRRlR�R"t
add_fieldsR R�R/RROtupdate_can_self_selectR�RARmRRRRFt
add_filtertrelated_idsRR:(RtcountRtmust_pre_selecttidentsR
R0Rp((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR)�s2

		"((R#R$RBRR)(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRE�s	-	tSQLAggregateCompilercBseZdd�ZRS(cCs�|dkr|j}ngg}}xO|jjj�D];}|j||j�\}}|j|�|j|�q8Wdj	|�}t
|�}d||jjf}||jj}||fS(sh
        Creates the SQL for this query. Returns the SQL string and list of
        parameters.
        s, sSELECT %s FROM (%s) subqueryN(
RR1RR~R�RBRRHRFRRVtsubqueryt
sub_params(RR3R�RdR�R�R�((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRBs

N(R#R$RRB(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRZstSQLDateCompilercBseZd�ZRS(c
cs�t|d�}|r4ddlm}|�g}nddlm}|jjj}t|j	j
�}x�|jt�D]�}xx|D]p}||}	|r�|j
||�|}	n|r�|t|	��}	nt|	tj�r�|	j�}	n|	Vq�WquWdS(sQ
        Returns an iterator over the results from executing this query.
        Ri����(t	DateField(t
typecast_dateN(Rztdjango.db.models.fieldsR^tdjango.db.backends.utilR_RROtneeds_datetime_string_castRxRR,RRRR�Rutdatetimetdate(
RRR^RR_tneeds_string_casttoffsetR
RRd((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR's"

(R#R$R(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR]&stSQLDateTimeCompilercBseZd�ZRS(c
cs.t|d�}|r4ddlm}|�g}nddlm}|jjj}t|j	j
�}x�|jt�D]�}x�|D]�}||}	|r�|j
||�|}	n|r�|t|	��}	ntjr|	dkr�td��n|	jdd�}	tj|	|j	j�}	n|	Vq�WquWdS(sQ
        Returns an iterator over the results from executing this query.
        Ri����(t
DateTimeField(ttypecast_timestamps{Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?ttzinfoN(RzR`RhRaRiRRORbRxRR,RRRR�RtUSE_TZRt
ValueErrortreplaceRt
make_awareRj(
RRRhRRiReRfR
RRc((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR@s(

	(R#R$R(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRg?sc#sDx=t�fd�|�D]#}g|D]}|| ^q&VqWdS(s+
    Yields blocks of rows from a cursor. We use this iterator in the special
    case when extra output columns have been added to support ordering
    requirements. We must trim those extra columns before anything else can use
    the results, since they're only needed to make the SQL valid.
    cs
�jt�S(N(RR	((R(s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyRfsN(R(RttrimtsentinelR
R0((Rs?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyR_s
(+Rctdjango.confRtdjango.core.exceptionsRRaRtdjango.db.models.constantsRtdjango.db.models.query_utilsRRtdjango.db.models.sql.constantsRRRR	R
t#django.db.models.sql.datastructuresRt django.db.models.sql.expressionsRtdjango.db.models.sql.queryR
Rtdjango.db.transactionRtdjango.db.utilsRtdjango.utilsRtdjango.utils.six.movesRRtobjectRR%RDRERZR]RgR(((s?/tmp/pip-install-XxeQeY/django/django/db/models/sql/compiler.pyt<module>s2(���(Wr 

https://t.me/AnonymousX5 - 2025