|
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 : |
�
r�\c @ s� d Z d d l Z d d l m Z m Z e � Z e � Z d e f d � � YZ d e f d � � YZ d e f d � � YZ
d
e f d � � YZ d e f d
� � YZ d e f d � � YZ
d e f d � � YZ d e f d � � YZ d S( s:
Classes to represent the default SQL aggregate functions
i����N( t IntegerFieldt
FloatFieldt Aggregatec B sA e Z d Z e Z e Z d Z d e d � Z d � Z d � Z
RS( s
Default SQL Aggregate.
s %(function)s(%(field)s)c K s� | | _ | | _ | | _ | | _ | } xX | r� t | t � r� t | d t � r] t } q- t | d t � rx t } q- | j } q- W| | _
d S( sK Instantiate an SQL aggregate
* col is a column reference describing the subject field
of the aggregate. It can be an alias, or a tuple describing
a table and column name.
* source is the underlying field or aggregate definition for
the column reference. If the aggregate is not an ordinal or
computed type, this reference is used to determine the coerced
output type of the aggregate.
* extra is a dictionary of additional data to provide for the
aggregate definition
Also utilizes the class variables:
* sql_function, the name of the SQL function that implements the
aggregate.
* sql_template, a template string that is used to render the
aggregate into SQL.
* is_ordinal, a boolean indicating if the output of this aggregate
is an integer (e.g., a count)
* is_computed, a boolean indicating if this output of this aggregate
is a computed float (e.g., an average), regardless of the input
type.
t
is_ordinalt is_computedN( t colt sourcet
is_summaryt extrat
isinstanceR t getattrt Falset ordinal_aggregate_fieldt computed_aggregate_fieldt field( t selfR R R R t tmp( ( sA /tmp/pip-install-XxeQeY/django/django/db/models/sql/aggregates.pyt __init__ s
c C s^ t j | � } t | j t t f � rZ | j | j d | j d � | j d f | _ n | S( Ni i ( t copyR R t listt tuplet get( R t
change_mapt clone( ( sA /tmp/pip-install-XxeQeY/django/django/db/models/sql/aggregates.pyt relabeled_cloneB s 3c C s� g } t | j d � r6 | j j | | � \ } } nO t | j t t f � r| d j g | j D] } | | � ^ q^ � } n | j } i | j d 6| d 6} | j | j � | j
| | f S( s6 Return the aggregate, rendered as SQL with parameters.t as_sqlt .t functionR ( t hasattrR R R R R t joint sql_functiont updateR t sql_template( R t qnt
connectiont paramst
field_namet ct
substitutions( ( sA /tmp/pip-install-XxeQeY/django/django/db/models/sql/aggregates.pyR H s .
N( t __name__t
__module__t __doc__R R R R t NoneR R R ( ( ( sA /tmp/pip-install-XxeQeY/django/django/db/models/sql/aggregates.pyR s . t Avgc B s e Z e Z d Z RS( t AVG( R'