OwlCyberSecurity - MANAGER
Edit File: datastructures.cpython-39.pyc
a ���e� � @ s^ d Z ddlmZ ddlmZmZ G dd� de�ZG dd� d�ZG dd � d �Z G d d� d�Z dS ) z] Useful auxiliary data structures for query construction. Not useful outside the SQL domain. � )� FullResultSet)�INNER�LOUTERc @ s e Zd ZdZdd� ZdS )� MultiJoinz� 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 C s || _ || _d S �N)�levelZnames_with_path)�selfZ names_posZpath_with_names� r �d/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/db/models/sql/datastructures.py�__init__ s zMultiJoin.__init__N)�__name__� __module__�__qualname__�__doc__r r r r r r s r c @ s e Zd ZdS )�EmptyN)r r r r r r r r s r c @ s^ e Zd ZdZddd�Zdd� Zdd� Zed d � �Zdd� Z d d� Z dd� Zdd� Zdd� Z dS )�Joina� 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 C s8 || _ || _|| _|| _|�� | _|| _|| _|| _d S r ) � table_name�parent_alias�table_alias� join_typeZget_joining_columns� join_cols� join_field�nullable�filtered_relation)r r r r r r r r r r r r - s z Join.__init__c C s: g }g }|j }|jj}| jD ]2\}}|�d|| j�||�|| j�||�f � q| j�| j| j�} | r�|� | �\} }|�d| � |� |� | jr�z|� | j�\} }W n ty� Y n0 |�d| � |� |� |s�t | jd| j�}td|j ��d�|�} | j| jk�rdnd| j }d| j|| j�|| f }||fS ) z� Generate the full LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params clause for this join. z %s.%s = %s.%sz(%s)�fieldzaJoin generated an empty ON clause. %s did not yield either joining columns or extra restrictions.z AND � � %sz%s %s%s ON (%s))�quote_name_unless_alias�opsZ quote_namer �appendr r r Zget_extra_restriction�compile�extendr r �getattr� ValueError� __class__�joinr r )r �compiler� connectionZjoin_conditions�params�qnZqn2Zlhs_colZrhs_colZ extra_condZ extra_sqlZextra_paramsZdeclared_fieldZ on_clause_sql� alias_str�sqlr r r �as_sqlG sZ ���� �� ��zJoin.as_sqlc sr � � | j| j�}� � | j| j�}| jd urN| j�� }� fdd�| jjD �|_nd }| j| j||| j| j | j |d�S )Nc s g | ]}� � ||��qS r )�get)�.0�p�� change_mapr r � <listcomp>� s z(Join.relabeled_clone.<locals>.<listcomp>)r )r- r r r �clone�pathr$ r r r r )r r1 Znew_parent_aliasZnew_table_aliasr r r0 r �relabeled_clone� s"