
    hO                          S r SSKrSSKJr  SSKJrJr  SSKJr   " S S\	5      r
 " S S	5      r " S
 S5      r " S S5      rg)z]
Useful auxiliary data structures for query construction. Not useful outside
the SQL domain.
    N)FullResultSet)INNERLOUTER)RemovedInDjango60Warningc                       \ rS rSrSrS rSrg)	MultiJoin   z
Used by join construction code to indicate the point at which a
multi-valued join was attempted (if the caller wants to treat that
exceptionally).
c                     Xl         X l        g Nlevelnames_with_path)self	names_pospath_with_namess      U/var/www/html/env/lib/python3.13/site-packages/django/db/models/sql/datastructures.py__init__MultiJoin.__init__   s    
.    r   N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__ r   r   r   r      s    /r   r   c                       \ rS rSrSrg)Empty   r   N)r   r   r   r   r   r   r   r   r   r      s    r   r   c                   X    \ rS rSrSr SS jrS rS r\S 5       r	S r
S	 rS
 rS rSrg)Join   a  
Used by sql.Query and sql.SQLCompiler to generate JOIN clauses into the
FROM entry. For example, the SQL generated could be
    LEFT OUTER JOIN "sometable" T1
    ON ("othertable"."sometable_id" = "sometable"."id")

This class is primarily used in Query.alias_map. All entries in alias_map
must be Join compatible by providing the following attributes and methods:
    - table_name (string)
    - table_alias (possible alias for the table, can be None)
    - join_type (can be None for those entries that aren't joined from
      anything)
    - parent_alias (which table is this join's parent, can be None similarly
      to join_type)
    - as_sql()
    - relabeled_clone()
Nc                 V   Xl         X l        X0l        X@l        [	        US5      (       a7  UR                  5       U l        [        S U R                   5       5      U l        O7[        R                  " S[        5        S U l        UR                  5       U l        XPl        X`l        Xpl        g )Nget_joining_fieldsc              3   V   #    U  H  u  pUR                   UR                   4v   M!     g 7fr   )column).0	lhs_field	rhs_fields      r   	<genexpr> Join.__init__.<locals>.<genexpr>F   s+      #,<(I !!9#3#34,<s   ')zaThe usage of get_joining_columns() in Join is deprecated. Implement get_joining_fields() instead.)
table_nameparent_aliastable_alias	join_typehasattrr$   join_fieldstuple	join_colswarningswarnr   get_joining_columns
join_fieldnullablefiltered_relation)r   r,   r-   r.   r/   r7   r8   r9   s           r   r   Join.__init__1   s     %(&" :344)<<>D" #,0,<,<# DN
 MM0(
  $D';;=DN$ !2r   c                 8   / n/ nUR                   nUR                  R                  nU R                  =(       d    U R                  nU H  u  p[        U[        5      (       a?  U" U R                  5      < SU" U5      < 3n
U" U R                  5      < SU" U	5      < 3nOaUR                  R                  U R                  XR                  U	5      u  pUR                  U5      u  pX-  n
UR                  U	5      u  pX-  nUR                  U
 SU 35        M     U R                  R                  U R                  U R                  5      nU(       a9  UR                  U5      u  nnUR                  SU-  5        UR                  U5        U R                  (       aD   UR                  U R                  5      u  nnUR                  SU-  5        UR                  U5        U(       d9  [#        U R                  SU R                  5      n[%        SUR&                  -  5      eSR)                  U5      nU R                  U R*                  :X  a  SOSU R                  -  nU R,                  < S	U" U R*                  5      < U< S
U< S3nUU4$ ! [          a     Nf = f)zy
Generate the full
   LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params
clause for this join.
.z = z(%s)fieldzaJoin generated an empty ON clause. %s did not yield either joining columns or extra restrictions.z AND   %s z ON ())quote_name_unless_aliasops
quote_namer1   r3   
isinstancestrr-   r.   prepare_join_on_clausecompileappendr7   get_extra_restrictionextendr9   r   getattr
ValueError	__class__joinr,   r/   )r   compiler
connectionjoin_conditionsparamsqnqn2r1   lhsrhslhs_full_namerhs_full_namelhs_sql
lhs_paramsrhs_sql
rhs_params
extra_cond	extra_sqlextra_paramsdeclared_fieldon_clause_sql	alias_strsqls                          r   as_sqlJoin.as_sqlX   sa    --nn'' &&8$..#HC#s## ,.d.?.?+@#c( K+-d.>.>+?S J%>>@@%%s,<,<c '/&6&6s&;# ' 4&.&6&6s&;# ' 4""m_C#GH $$ __::d//

 &.&6&6z&B#I|""6I#56MM,'!!,*2*:*:4;Q;Q*R'	<  &&v	'9:l+$T__gtON9;I;S;ST   _5""doo5BEDDTDT<T 	 NNt	
 F{- ! s   J 
JJc           
      j   UR                  U R                  U R                  5      nUR                  U R                  U R                  5      nU R                  b  U R                  R	                  U5      nOS nU R                  U R                  UUU R                  U R                  U R                  US9$ )N)r9   )
getr-   r.   r9   relabeled_clonerN   r,   r/   r7   r8   )r   
change_mapnew_parent_aliasnew_table_aliasr9   s        r   ri   Join.relabeled_clone   s    %>>$*;*;T=N=NO$..)9)94;K;KL!!- $ 6 6 F Fz R $~~OONNOOMM/  
 	
r   c                 t    U R                   U R                  U R                  U R                  U R                  4$ r   )rN   r,   r-   r7   r9   r   s    r   identityJoin.identity   s5     NNOOOO""
 	
r   c                 j    [        U[        5      (       d  [        $ U R                  UR                  :H  $ r   )rE   r!   NotImplementedrp   r   others     r   __eq__Join.__eq__   s(    %&&!!}}..r   c                 ,    [        U R                  5      $ r   hashrp   ro   s    r   __hash__Join.__hash__       DMM""r   c                 >    U R                  0 5      n[        Ul        U$ r   )ri   r   r/   r   news     r   demoteJoin.demote   s    ""2&
r   c                 >    U R                  0 5      n[        Ul        U$ r   )ri   r   r/   r   s     r   promoteJoin.promote   s    ""2&
r   )	r9   r3   r7   r1   r/   r8   r-   r.   r,   r   )r   r   r   r   r   r   re   ri   propertyrp   rv   r{   r   r   r   r   r   r   r!   r!      sF    4 %3N@D
" 
 
/
#
r   r!   c                   R    \ rS rSrSrSrSrSrS rS r	S r
\S 5       rS rS	 rS
rg)	BaseTable   z
The BaseTable class is used for base table references in FROM clause. For
example, the SQL "foo" in
    SELECT * FROM "foo" WHERE somecond
could be generated by this class.
Nc                     Xl         X l        g r   )r,   r.   )r   r,   aliass      r   r   BaseTable.__init__   s    $ r   c                     U R                   U R                  :X  a  SOSU R                   -  nUR                  U R                  5      nXC-   / 4$ )Nr>   r?   )r.   r,   rB   )r   rP   rQ   rc   base_sqls        r   re   BaseTable.as_sql   sL    ""doo5BEDDTDT<T 	 33DOOD#R''r   c                     U R                  U R                  UR                  U R                  U R                  5      5      $ r   )rN   r,   rh   r.   )r   rj   s     r   ri   BaseTable.relabeled_clone   s3    ~~OOZ^^D,<,<d>N>NO
 	
r   c                 H    U R                   U R                  U R                  4$ r   )rN   r,   r.   ro   s    r   rp   BaseTable.identity   s    ~~t0@0@@@r   c                 j    [        U[        5      (       d  [        $ U R                  UR                  :H  $ r   )rE   r   rs   rp   rt   s     r   rv   BaseTable.__eq__   s(    %++!!}}..r   c                 ,    [        U R                  5      $ r   ry   ro   s    r   r{   BaseTable.__hash__   r}   r   )r.   r,   )r   r   r   r   r   r/   r-   r9   r   re   ri   r   rp   rv   r{   r   r   r   r   r   r      sH     IL!(

 A A/
#r   r   )r   r4   django.core.exceptionsr   django.db.models.sql.constantsr   r   django.utils.deprecationr   	Exceptionr   r   r!   r   r   r   r   <module>r      sE   
  0 8 =
/	 
/	 	g gT&# &#r   