File manager - Edit - /usr/local/CyberCP/lib/python3.10/site-packages/django/db/models/sql/__pycache__/datastructures.cpython-310.pyc
Back
o �h� � @ 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 � || _ || _d S �N)�level�names_with_path)�self� names_pos�path_with_names� r �V/usr/local/CyberCP/lib/python3.10/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 ZdZ ddd�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_type�get_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 s8 g }g }|j }|jj}| jD ]\}}|�d|| j�||�|| j�||�f � q| j�| j| j�} | rF|� | �\} }|�d| � |� |� | jriz |� | j�\} }W n ty\ Y n w |�d| � |� |� |szt | jd| j�}td|j ��d�|�} | j| jkr�dnd| 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�ops� quote_namer �appendr r r �get_extra_restriction�compile�extendr r �getattr� ValueError� __class__�joinr r )r �compiler� connection�join_conditions�params�qn�qn2�lhs_col�rhs_col� extra_cond� extra_sql�extra_params�declared_field� on_clause_sql� alias_str�sqlr r r �as_sqlG s\ ���� � �� ��zJoin.as_sqlc sr � � | j| j�}� � | j| j�}| jd ur'| 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 rA �new_parent_alias�new_table_aliasr r r@ r �relabeled_clone� s"