3
[S	                 @   s~   d dl mZ d dlmZ G dd dejZG dd dejeZG dd dejeZG d	d
 d
ejeZG dd dejeZdS )    )NotSupportedError)compilerc                   s   e Zd Zd fdd	Z  ZS )SQLCompilerTFc                s   |o| j jdk	p| j j}|s2t jd|d\}}nx| jjj rP| j jrPt	dnZt jddd\}}d}| j jdk	rd| j jf }| j jrd||| j jf }nd	||f }||fS )
ae  
        Create the SQL for this query. Return the SQL string and list of
        parameters. This is overridden from the original Query class to handle
        the restriction in Oracle 12.1 and emulate LIMIT and OFFSET with
        a subquery.

        If 'with_limits' is False, any limit/offset information is not included
        in the query.
        NF)with_limitswith_col_aliaseszNLIMIT/OFFSET is not supported with select_for_update on this database backend.T zWHERE ROWNUM <= %dzUSELECT * FROM (SELECT "_SUB".*, ROWNUM AS "_RN" FROM (%s) "_SUB" %s) WHERE "_RN" > %dz3SELECT * FROM (SELECT "_SUB".* FROM (%s) "_SUB" %s))
queryZ	high_markZlow_marksuperas_sql
connectionfeaturesZ%supports_select_for_update_with_limitZselect_for_updater   )selfr   r   Z	do_offsetZsqlparamsZ
high_where)	__class__ F/tmp/pip-install-j7i95hgp/django/django/db/backends/oracle/compiler.pyr
      s    zSQLCompiler.as_sql)TF)__name__
__module____qualname__r
   __classcell__r   r   )r   r   r      s   r   c               @   s   e Zd ZdS )SQLInsertCompilerN)r   r   r   r   r   r   r   r   /   s   r   c               @   s   e Zd ZdS )SQLDeleteCompilerN)r   r   r   r   r   r   r   r   3   s   r   c               @   s   e Zd ZdS )SQLUpdateCompilerN)r   r   r   r   r   r   r   r   7   s   r   c               @   s   e Zd ZdS )SQLAggregateCompilerN)r   r   r   r   r   r   r   r   ;   s   r   N)	Z	django.dbr   Zdjango.db.models.sqlr   r   r   r   r   r   r   r   r   r   <module>   s   *