o
    i
                     @   sX   d dl mZmZmZmZmZ g dZG dd de	Z
G dd deZG dd deZdS )	    )SQLAggregateCompilerSQLCompilerSQLDeleteCompilerSQLInsertCompilerSQLUpdateCompilerc                   @   s   e Zd ZdZdd ZdS )InsertUnnestz
    Sentinel value to signal DatabaseOperations.bulk_insert_sql() that the
    UNNEST strategy should be used for the bulk insert.
    c                 C   s   dd |  S )Nz
UNNEST(%s)z, )joinself r   f/var/www/html/formularioweb/env/lib/python3.10/site-packages/django/db/backends/postgresql/compiler.py__str__   s   zInsertUnnest.__str__N)__name__
__module____qualname____doc__r   r   r   r   r   r      s    r   c                          e Zd Z fddZ  ZS )r   c                    s   d|v rt dt |S )N$z?Dollar signs are not permitted in column aliases on PostgreSQL.)
ValueErrorsuperquote_name_unless_alias)r
   name	__class__r   r   r      s
   z#SQLCompiler.quote_name_unless_alias)r   r   r   r   __classcell__r   r   r   r   r          r   c                       r   )r   c                    s   t |dks,tdd |D s,tdd |D s,t fdd|D s,tdd |D r3t ||S  fdd|D }td	d |D tttt| gfS )
N   c                 s   s    | ]}|d u V  qd S Nr   .0fieldr   r   r   	<genexpr>/   s    z4SQLInsertCompiler.assemble_as_sql.<locals>.<genexpr>c                 s       | ]}t |d V  qdS )get_placeholderNhasattrr   r   r   r   r!   4       c                 3   s,    | ]}|j r
|jn|  jjvV  qd S r   )is_relationtarget_fieldget_internal_type
connection
data_typesr   r	   r   r   r!   8   s    
c                 s   s"    | ]}t d d |D V  qdS )c                 s   r"   )as_sqlNr$   )r   valuer   r   r   r!   >   r&   z>SQLInsertCompiler.assemble_as_sql.<locals>.<genexpr>.<genexpr>N)any)r   rowr   r   r   r!   >   s     c                    s"   g | ]}|  jd d qS )(r   )db_typer*   splitr   r	   r   r   
<listcomp>C   s   " z5SQLInsertCompiler.assemble_as_sql.<locals>.<listcomp>c                 S   s   g | ]}d | qS )z(%%s)::%s[]r   )r   r1   r   r   r   r3   D   s    )lenr.   r   assemble_as_sqlr   listmapzip)r
   fields
value_rowsdb_typesr   r	   r   r5   &   s    z!SQLInsertCompiler.assemble_as_sql)r   r   r   r5   r   r   r   r   r   r   %   r   r   N)django.db.models.sql.compilerr   r   BaseSQLCompilerr   r   BaseSQLInsertCompilerr   __all__r6   r   r   r   r   r   <module>   s
    	
	