
    hv                         S SK r S SKrS SKrS SKrS SKJr  S SKrS SKJr  S SK	J
r
Jr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr   " S
 S5      rg)    N)import_module)settings)NotSupportedErrortransaction)utilsCol)timezone)RemovedInDjango60Warning	force_strc            
       |   \ rS rSrSrSrSSSSSS	SSSS
.	rSSSS.r0 rSr	Sr
SrS\
-   rS\-   rSrSrS rS rS rS rS rS rS rSdS jrS rS rS rS rSdS  jrS! rS" rS# rS$ r S% r!S& r"S' r#SeS) jr$S* r%S+ r&S, r'S- r(S. r)SdS/ jr*S0 r+S1 r,S2 r-S3 r.S4 r/S5 r0S6 r1S7 r2S8 r3S9 r4S: r5S; r6S< r7S= r8S(S(S>.S? jr9S@ r:SA r;SB r<SC r=SfSD jr>SgSE jr?SF r@\@rASG rBSH rCSI rDSJ rESK rFSL rGShSM jrHSN rISO rJSgSP jrKSgSQ jrLSR rMSS rNST rOSU rPSV rQSW rRSX rSSY rTSZ rUS[ rVS\ rWShS] jrXShS^ jrYSdS_ jrZSdS` jr[Sa r\Sb r]Scr^g)iBaseDatabaseOperations   z
Encapsulate backend-specific differences, such as the way a backend
performs ordering or calculates the ID of a recently-inserted row.
zdjango.db.models.sql.compiler)i   )i   )l             )r   r   )r   r   )r   r   )	SmallIntegerFieldIntegerFieldBigIntegerFieldPositiveBigIntegerFieldPositiveSmallIntegerFieldPositiveIntegerFieldSmallAutoField	AutoFieldBigAutoFieldUNION	INTERSECTEXCEPT)unionintersection
differenceN	PRECEDING	FOLLOWINGz
UNBOUNDED zCURRENT ROWc                     Xl         S U l        g N)
connection_cache)selfr'   s     T/var/www/html/env/lib/python3.13/site-packages/django/db/backends/base/operations.py__init__BaseDatabaseOperations.__init__=   s    $    c                     g)z
Return any SQL needed to support auto-incrementing primary keys, or
None if no SQL is necessary.

This SQL is executed when a table is created.
N )r)   tablecolumns      r*   autoinc_sql"BaseDatabaseOperations.autoinc_sqlA   s     r-   c                     [        U5      $ )z
Return the maximum allowed batch size for the backend. The fields
are the fields going to be inserted in the batch, the objs contains
all the objects to be inserted.
)len)r)   fieldsobjss      r*   bulk_batch_size&BaseDatabaseOperations.bulk_batch_sizeJ   s     4yr-   c                     [        S5      e)Nz[subclasses of BaseDatabaseOperations may require a format_for_duration_arithmetic() method.NotImplementedError)r)   sqls     r*   format_for_duration_arithmetic5BaseDatabaseOperations.format_for_duration_arithmeticR   s    !7
 	
r-   c                 6    U R                  S5      nSU SU S3$ )z
Return an SQL query that retrieves the first cache key greater than the
n smallest.

This is used by the 'db' cache backend to determine where to start
culling.
	cache_keyzSELECT z FROM %s ORDER BY z LIMIT 1 OFFSET %%s
quote_name)r)   rA   s     r*   cache_key_culling_sql,BaseDatabaseOperations.cache_key_culling_sqlX   s)     OOK0	#5i[@STTr-   c                     g)z
Given a field instance, return the SQL that casts the result of a union
to that type. The resulting string should contain a '%s' placeholder
for the expression being cast.
%sr/   )r)   output_fields     r*   unification_cast_sql+BaseDatabaseOperations.unification_cast_sqlc        r-   c                     [        S5      e)z~
Given a lookup_type of 'year', 'month', or 'day', return the SQL that
extracts a value from the given date field field_name.
zLsubclasses of BaseDatabaseOperations may require a date_extract_sql() methodr;   r)   lookup_typer=   paramss       r*   date_extract_sql'BaseDatabaseOperations.date_extract_sqlk   s    
 "
 	
r-   c                     [        S5      e)z
Given a lookup_type of 'year', 'month', or 'day', return the SQL that
truncates the given date or datetime field field_name to a date object
with only the given specificity.

If `tzname` is provided, the given value is truncated in a specific
timezone.
zKsubclasses of BaseDatabaseOperations may require a date_trunc_sql() method.r;   r)   rN   r=   rO   tznames        r*   date_trunc_sql%BaseDatabaseOperations.date_trunc_sqlu   s     "
 	
r-   c                     [        S5      e)z8
Return the SQL to cast a datetime value to date value.
zSsubclasses of BaseDatabaseOperations may require a datetime_cast_date_sql() method.r;   r)   r=   rO   rT   s       r*   datetime_cast_date_sql-BaseDatabaseOperations.datetime_cast_date_sql   s     "/
 	
r-   c                     [        S5      e)z8
Return the SQL to cast a datetime value to time value.
zRsubclasses of BaseDatabaseOperations may require a datetime_cast_time_sql() methodr;   rX   s       r*   datetime_cast_time_sql-BaseDatabaseOperations.datetime_cast_time_sql   s     ".
 	
r-   c                     [        S5      e)z
Given a lookup_type of 'year', 'month', 'day', 'hour', 'minute', or
'second', return the SQL that extracts a value from the given
datetime field field_name.
zPsubclasses of BaseDatabaseOperations may require a datetime_extract_sql() methodr;   rS   s        r*   datetime_extract_sql+BaseDatabaseOperations.datetime_extract_sql        "
 	
r-   c                     [        S5      e)z
Given a lookup_type of 'year', 'month', 'day', 'hour', 'minute', or
'second', return the SQL that truncates the given datetime field
field_name to a datetime object with only the given specificity.
zNsubclasses of BaseDatabaseOperations may require a datetime_trunc_sql() methodr;   rS   s        r*   datetime_trunc_sql)BaseDatabaseOperations.datetime_trunc_sql   ra   r-   c                     [        S5      e)a  
Given a lookup_type of 'hour', 'minute' or 'second', return the SQL
that truncates the given time or datetime field field_name to a time
object with only the given specificity.

If `tzname` is provided, the given value is truncated in a specific
timezone.
zJsubclasses of BaseDatabaseOperations may require a time_trunc_sql() methodr;   rS   s        r*   time_trunc_sql%BaseDatabaseOperations.time_trunc_sql   s     "X
 	
r-   c                 &    U R                  XU5      $ )z
Given a lookup_type of 'hour', 'minute', or 'second', return the SQL
that extracts a value from the given time field field_name.
)rP   rM   s       r*   time_extract_sql'BaseDatabaseOperations.time_extract_sql   s    
 $$[v>>r-   c                     g)z[
Return the SQL to make a constraint "initially deferred" during a
CREATE TABLE statement.
 r/   r)   s    r*   deferrable_sql%BaseDatabaseOperations.deferrable_sql   s    
 r-   c                 0    U(       a  [        S5      eS// 4$ )z
Return an SQL DISTINCT clause which removes duplicate rows from the
result set. If any fields are given, only check the given fields for
duplicates.
z<DISTINCT ON fields is not supported by this database backendDISTINCT)r   )r)   r6   rO   s      r*   distinct_sql#BaseDatabaseOperations.distinct_sql   s&     #N  <##r-   c                 "    UR                  5       $ )z|
Given a cursor object that has just performed an INSERT...RETURNING
statement into a table, return the newly created data.
)fetchone)r)   cursorreturning_paramss      r*   fetch_returned_insert_columns4BaseDatabaseOperations.fetch_returned_insert_columns   s    
   r-   c                 :    [         R                  " S[        5        g)a  
Given a column type (e.g. 'BLOB', 'VARCHAR') and an internal type
(e.g. 'GenericIPAddressField'), return the SQL to cast it before using
it in a WHERE statement. The resulting string should contain a '%s'
placeholder for the column being searched against.
z_DatabaseOperations.field_cast_sql() is deprecated use DatabaseOperations.lookup_cast() instead.rG   )warningswarnr   )r)   db_typeinternal_types      r*   field_cast_sql%BaseDatabaseOperations.field_cast_sql   s     	< %	
 r-   c                     / $ )zU
Return a GROUP BY clause to use with a HAVING clause when no grouping
is specified.
r/   rm   s    r*   force_group_by%BaseDatabaseOperations.force_group_by   	    
 	r-   c                     / $ )z
Return a list used in the "ORDER BY" clause to force no ordering at
all. Return an empty list to include nothing in the ordering.
r/   rm   s    r*   force_no_ordering(BaseDatabaseOperations.force_no_ordering   r   r-   Fc                     SU(       a  SOS< SU(       a  SSR                  U5      -  OS< U(       a  SOS< U(       a  S< 3$ S< 3$ )	zH
Return the FOR UPDATE SQL clause to lock rows for an update operation.
FORz NO KEYrl   z UPDATEz OF %s, z NOWAITz SKIP LOCKEDjoin)r)   nowaitskip_lockedofno_keys        r*   for_update_sql%BaseDatabaseOperations.for_update_sql   sS    
  IR'(*Htyy}$2IR')N1	
 	
 021	
 	
r-   c                     U=(       d    SnUb  X#-
  U4$ U(       a&  U R                   R                  R                  5       U4$ S U4$ Nr   )r'   opsno_limit_value)r)   low_mark	high_markoffsets       r*   _get_limit_offset_params/BaseDatabaseOperations._get_limit_offset_params  sJ    Q &//??&&557??V|r-   c                     U R                  X5      u  p4SR                  S U(       a  SU-  OSU(       a  SU-  OS4 5       5      $ )zReturn LIMIT/OFFSET SQL clause. c              3   8   #    U  H  nU(       d  M  Uv   M     g 7fr&   r/   ).0r=   s     r*   	<genexpr>:BaseDatabaseOperations.limit_offset_sql.<locals>.<genexpr>  s"      
  Cs   	zLIMIT %dNz	OFFSET %d)r   r   )r)   r   r   limitr   s        r*   limit_offset_sql'BaseDatabaseOperations.limit_offset_sql  sN    55hJxx 
 ).e#4*0v%d
 
 	
r-   c                 t    S U 5       nSR                  U Vs/ s H	  nSU S3PM     sn5      nSU 3$ s  snf )Nc              3   D   #    U  H  nS R                  U5      v   M     g7f)r   Nr   )r   rows     r*   r   9BaseDatabaseOperations.bulk_insert_sql.<locals>.<genexpr>  s     K:J3		#:Js    r   ()zVALUES r   )r)   r6   placeholder_rowsplaceholder_rows_sqlr=   
values_sqls         r*   bulk_insert_sql&BaseDatabaseOperations.bulk_insert_sql  sI    K:JKYY6JK6Js!C5
6JKL
%%  Ls   5c                    ^ S m[        U[        [        45      (       a  [        U4S jU 5       5      nO7Uc  SnO1UR                  5        VVs0 s H  u  pVT" U5      T" U5      _M     nnnSU< SU< 3$ s  snnf )a_  
Return a string of the query last executed by the given cursor, with
placeholders replaced with actual values.

`sql` is the raw query containing placeholders and `params` is the
sequence of parameters. These are used by default, but this method
exists for database backends to provide a better implementation
according to their own quoting schemes.
c                     [        U SSS9$ )NTreplace)strings_onlyerrorsr   )ss    r*   	to_string=BaseDatabaseOperations.last_executed_query.<locals>.to_string(  s    QT)DDr-   c              3   4   >#    U  H  nT" U5      v   M     g 7fr&   r/   )r   valr   s     r*   r   =BaseDatabaseOperations.last_executed_query.<locals>.<genexpr>,  s     >vYs^^vs   r/   zQUERY = z - PARAMS = )
isinstancelisttupleitems)r)   rv   r=   rO   u_paramskvr   s          @r*   last_executed_query*BaseDatabaseOperations.last_executed_query  sq    	E ftUm,,>v>>H^H?E||~N~tq	!il2~HN-0(;; Os   A7c                     UR                   $ )z
Given a cursor object that has just performed an INSERT statement into
a table that has an auto-incrementing ID, return the newly created ID.

`pk_name` is the name of the primary-key column.
)	lastrowid)r)   rv   
table_namepk_names       r*   last_insert_id%BaseDatabaseOperations.last_insert_id4  s     r-   c                     g)z
Return the string to use in a query when performing lookups
("contains", "like", etc.). It should contain a '%s' placeholder for
the column being searched against.
rG   r/   )r)   rN   r~   s      r*   lookup_cast"BaseDatabaseOperations.lookup_cast=  rK   r-   c                     g)z
Return the maximum number of items that can be passed in a single 'IN'
list condition, or None if the backend does not impose a limit.
Nr/   rm   s    r*   max_in_list_size'BaseDatabaseOperations.max_in_list_sizeE      
 r-   c                     g)zT
Return the maximum length of table and column names, or None if there
is no limit.
Nr/   rm   s    r*   max_name_length&BaseDatabaseOperations.max_name_lengthL  r   r-   c                     [        S5      e)z
Return the value to use for the LIMIT when we are wanting "LIMIT
infinity". Return None if the limit clause can be omitted in this case.
zJsubclasses of BaseDatabaseOperations may require a no_limit_value() methodr;   rm   s    r*   r   %BaseDatabaseOperations.no_limit_valueS  s    
 "X
 	
r-   c                     g)zl
Return the value to use during an INSERT statement to specify that
the field should use its default value.
DEFAULTr/   rm   s    r*   pk_default_value'BaseDatabaseOperations.pk_default_value\  s    
 r-   c                     [         R                  " U5       Vs/ s H!  nU(       d  M  [         R                  " USS9PM#     sn$ s  snf )a7  
Take an SQL script that may contain multiple lines and return a list
of statements to feed to successive cursor.execute() calls.

Since few databases are able to process raw SQL scripts in a single
cursor.execute() call and PEP 249 doesn't talk about this use case,
the default implementation is conservative.
T)strip_comments)sqlparsesplitformat)r)   r=   	statements      r*   prepare_sql_script)BaseDatabaseOperations.prepare_sql_scriptc  sB     &^^C0
0	 <HOOId;0
 	
 
s
   AAc                     U$ )zs
Return the value of a CLOB column, for backends that return a locator
object that requires additional processing.
r/   r)   values     r*   process_clob#BaseDatabaseOperations.process_clobr  s	    
 r-   c                     g)z
For backends that support returning columns as part of an insert query,
return the SQL and params to append to the INSERT query. The returned
fragment should contain a format string to hold the appropriate column.
Nr/   )r)   r6   s     r*   return_insert_columns,BaseDatabaseOperations.return_insert_columnsy  s     	r-   c                 |    U R                   c  [        U R                  5      U l         [        U R                   U5      $ )z
Return the SQLCompiler class corresponding to the given name,
in the namespace corresponding to the `compiler_module` attribute
on this backend.
)r(   r   compiler_modulegetattr)r)   compiler_names     r*   compilerBaseDatabaseOperations.compiler  s1     ;;'(<(<=DKt{{M22r-   c                     [        S5      e)z}
Return a quoted version of the given table, index, or column name. Do
not quote the given name if it's already been quoted.
zFsubclasses of BaseDatabaseOperations may require a quote_name() methodr;   )r)   names     r*   rC   !BaseDatabaseOperations.quote_name  s    
 "T
 	
r-   c                     [        S5      e)a  
Return the string to use in a query when performing regular expression
lookups (using "regex" or "iregex"). It should contain a '%s'
placeholder for the column being searched against.

If the feature is not supported (or part of it is not supported), raise
NotImplementedError.
zHsubclasses of BaseDatabaseOperations may require a regex_lookup() methodr;   )r)   rN   s     r*   regex_lookup#BaseDatabaseOperations.regex_lookup  s     "V
 	
r-   c                 *    SU R                  U5      -  $ )z
Return the SQL for starting a new savepoint. Only required if the
"uses_savepoints" feature is True. The "sid" parameter is a string
for the savepoint id.
zSAVEPOINT %srB   r)   sids     r*   savepoint_create_sql+BaseDatabaseOperations.savepoint_create_sql  s      444r-   c                 *    SU R                  U5      -  $ )z4
Return the SQL for committing the given savepoint.
zRELEASE SAVEPOINT %srB   r   s     r*   savepoint_commit_sql+BaseDatabaseOperations.savepoint_commit_sql  s     &(<<<r-   c                 *    SU R                  U5      -  $ )z6
Return the SQL for rolling back the given savepoint.
zROLLBACK TO SAVEPOINT %srB   r   s     r*   savepoint_rollback_sql-BaseDatabaseOperations.savepoint_rollback_sql  s     *DOOC,@@@r-   c                     g)zp
Return the SQL that will set the connection's time zone.

Return '' if the backend doesn't support time zones.
rl   r/   rm   s    r*   set_time_zone_sql(BaseDatabaseOperations.set_time_zone_sql  s     r-   )reset_sequencesallow_cascadec                    [        S5      e)a2  
Return a list of SQL statements required to remove all data from
the given database tables (without actually removing the tables
themselves).

The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.

If `reset_sequences` is True, the list includes SQL statements required
to reset the sequences.

The `allow_cascade` argument determines whether truncation may cascade
to tables with foreign keys pointing the tables being truncated.
PostgreSQL requires a cascade even if these tables are empty.
zGsubclasses of BaseDatabaseOperations must provide an sql_flush() methodr;   )r)   styletablesr  r  s        r*   	sql_flush BaseDatabaseOperations.sql_flush  s      "U
 	
r-   c                 b   [         R                  " U R                  R                  U R                  R                  R
                  S9   U R                  R                  5        nU H  nUR                  U5        M     SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)z7Execute a list of SQL statements to flush the database.)using	savepointN)r   atomicr'   aliasfeaturescan_rollback_ddlrv   execute)r)   sql_listrv   r=   s       r*   execute_sql_flush(BaseDatabaseOperations.execute_sql_flush  s}    //''oo..??
 '')V#CNN3' $ *	
 
 *)	
 
s$   B #B>B 
B	B  
B.c                     / $ )z
Return a list of the SQL statements required to reset sequences
passed in `sequences`.

The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.
r/   )r)   r  	sequencess      r*   sequence_reset_by_name_sql1BaseDatabaseOperations.sequence_reset_by_name_sql  	     	r-   c                     / $ )z
Return a list of the SQL statements required to reset sequences for
the given models.

The `style` argument is a Style object as returned by either
color_style() or no_style() in django.core.management.color.
r/   )r)   r  
model_lists      r*   sequence_reset_sql)BaseDatabaseOperations.sequence_reset_sql  r  r-   c                     g)z9Return the SQL statement required to start a transaction.zBEGIN;r/   rm   s    r*   start_transaction_sql,BaseDatabaseOperations.start_transaction_sql  s    r-   c                     U(       d  gg)z7Return the SQL statement required to end a transaction.z	ROLLBACK;zCOMMIT;r/   )r)   successs     r*   end_transaction_sql*BaseDatabaseOperations.end_transaction_sql  s    r-   c                     g)z
Return the SQL that will be used in a query to define the tablespace.

Return '' if the backend doesn't support tablespaces.

If `inline` is True, append the SQL to a row; otherwise append it to
the entire CREATE TABLE or CREATE INDEX statement.
rl   r/   )r)   
tablespaceinlines      r*   tablespace_sql%BaseDatabaseOperations.tablespace_sql  s     r-   c                 x    [        U5      R                  SS5      R                  SS5      R                  SS5      $ )z(Prepare a value for use in a LIKE query.\z\\%z\%_z\_)strr   )r)   xs     r*   prep_for_like_query*BaseDatabaseOperations.prep_for_like_query  s1    1v~~dF+33C?GGUSSr-   c                     U$ )z
Certain backends do not accept some values for "serial" fields
(for example zero in MySQL). Raise a ValueError if the value is
invalid, otherwise return the validated value.
r/   r   s     r*   validate_autopk_value,BaseDatabaseOperations.validate_autopk_value  s	     r-   c                    [        U[        R                  5      (       a  U R                  U5      $ [        U[        R                  5      (       a  U R	                  U5      $ [        U[        R
                  5      (       a  U R                  U5      $ [        U[        R                  5      (       a  U R                  U5      $ U$ )a  
Transform a value to something compatible with the backend driver.

This method only depends on the type of the value. It's designed for
cases where the target type isn't known, such as .raw() SQL queries.
As a consequence it may not work perfectly in all circumstances.
)
r   datetimeadapt_datetimefield_valuedateadapt_datefield_valuetimeadapt_timefield_valuedecimalDecimaladapt_decimalfield_valuer   s     r*   adapt_unknown_value*BaseDatabaseOperations.adapt_unknown_value  s     eX..//11%88x}}----e44x}}----e44w//0077Lr-   c                     U$ r&   r/   )r)   r   r~   s      r*   adapt_integerfield_value/BaseDatabaseOperations.adapt_integerfield_value'  s    r-   c                      Uc  g[        U5      $ )zn
Transform a date value to an object compatible with what is expected
by the backend driver for date columns.
Nr/  r   s     r*   r:  ,BaseDatabaseOperations.adapt_datefield_value*      
 =5zr-   c                      Uc  g[        U5      $ )zv
Transform a datetime value to an object compatible with what is expected
by the backend driver for datetime columns.
NrF  r   s     r*   r8  0BaseDatabaseOperations.adapt_datetimefield_value3  rH  r-   c                 l    Uc  g[         R                  " U5      (       a  [        S5      e[        U5      $ )zn
Transform a time value to an object compatible with what is expected
by the backend driver for time columns.
Nz-Django does not support timezone-aware times.)r
   is_aware
ValueErrorr/  r   s     r*   r<  ,BaseDatabaseOperations.adapt_timefield_value<  s3    
 =U##LMM5zr-   c                 0    [         R                  " XU5      $ )z
Transform a decimal.Decimal value to an object compatible with what is
expected by the backend driver for decimal (numeric) columns.
)r   format_number)r)   r   
max_digitsdecimal_placess       r*   r?  /BaseDatabaseOperations.adapt_decimalfield_valueG  s    
 ""5nEEr-   c                     U=(       d    S$ )zc
Transform a string representation of an IP address into the expected
type for the backend driver.
Nr/   r   s     r*   adapt_ipaddressfield_value1BaseDatabaseOperations.adapt_ipaddressfield_valueN  s    
 }r-   c                 *    [         R                  " XS9$ )N)cls)jsondumps)r)   r   encoders      r*   adapt_json_value'BaseDatabaseOperations.adapt_json_valueU  s    zz%--r-   c                 p   U(       a[  [         R                  R                  USS5      n[         R                  R                  US-   SS5      [         R                  " SS9-
  nO0[         R                  " USS5      n[         R                  " USS5      nU R	                  U5      nU R	                  U5      nX4/$ )a	  
Return a two-elements list with the lower and upper bound to be used
with a BETWEEN operator to query a DateField value using a year
lookup.

`value` is an int, containing the looked-up year.
If `iso_year` is True, return bounds for ISO-8601 week-numbering years.
   )days      )r7  r9  fromisocalendar	timedeltar:  )r)   r   iso_yearfirstseconds        r*   !year_lookup_bounds_for_date_field8BaseDatabaseOperations.year_lookup_bounds_for_date_fieldX  s     MM11%A>E]]22	1a""*+F MM%A.E]]5"b1F**51++F3r-   c           	      $   U(       a[  [         R                   R                  USS5      n[         R                   R                  US-   SS5      [         R                  " SS9-
  nO4[         R                   " USS5      n[         R                   " USSSSSS5      n[        R                  (       aA  [
        R                  " 5       n[
        R                  " X55      n[
        R                  " XE5      nU R                  U5      nU R                  U5      nX4/$ )a  
Return a two-elements list with the lower and upper bound to be used
with a BETWEEN operator to query a DateTimeField value using a year
lookup.

`value` is an int, containing the looked-up year.
If `iso_year` is True, return bounds for ISO-8601 week-numbering years.
r_  )microsecondsra  rb     ;   i?B )	r7  rc  rd  r   USE_TZr
   get_current_timezone
make_awarer8  )r)   r   re  rf  rg  tzs         r*   %year_lookup_bounds_for_datetime_field<BaseDatabaseOperations.year_lookup_bounds_for_datetime_fieldm  s     %%55eQBE&&66	1a""23F %%eQ2E&&ub"b"b&IF??..0B''2E((4F..u5//7r-   c                     / $ )z
Return a list of functions needed to convert field data.

Some field types on some backends do not provide data in the correct
format, this is the hook for converter functions.
r/   r)   
expressions     r*   get_db_converters(BaseDatabaseOperations.get_db_converters  s	     	r-   c                 :    Ub  [         R                  " SSU5      $ g r   )r7  rd  )r)   r   rv  r'   s       r*   convert_durationfield_value2BaseDatabaseOperations.convert_durationfield_value  s"    %%aE22 r-   c                     g)a  
Check that the backend supports the provided expression.

This is used on specific backends to rule out known expressions
that have problematic or nonexistent implementations. If the
expression has a known problem, the backend should raise
NotSupportedError.
Nr/   ru  s     r*   check_expression_support/BaseDatabaseOperations.check_expression_support  s     	r-   c                     g)zN
Return True, if the conditional expression is supported in the WHERE
clause.
Tr/   ru  s     r*   0conditional_expression_supported_in_where_clauseGBaseDatabaseOperations.conditional_expression_supported_in_where_clause  r   r-   c                 .    SU-  nUR                  U5      $ )z
Combine a list of subexpressions into a single expression, using
the provided connecting operator. This is required because operators
can vary between backends (e.g., Oracle with %% and &) and between
subexpression types (e.g., date expressions).
z %s r   )r)   	connectorsub_expressionsconns       r*   combine_expression)BaseDatabaseOperations.combine_expression  s     	!yy))r-   c                 $    U R                  X5      $ r&   )r  )r)   r  r  s      r*   combine_duration_expression2BaseDatabaseOperations.combine_duration_expression  s    &&yBBr-   c                     g)zf
Some backends require special syntax to insert binary content (MySQL
for example uses '_binary %s').
rG   r/   r   s     r*   binary_placeholder_sql-BaseDatabaseOperations.binary_placeholder_sql  r   r-   c                     U$ )z[
Allow modification of insert parameters. Needed for Oracle Spatial
backend due to #10888.
r/   )r)   placeholderrO   s      r*   modify_insert_params+BaseDatabaseOperations.modify_insert_params  s	    
 r-   c                      U R                   U   $ )z
Given an integer field internal type (e.g. 'PositiveIntegerField'),
return a tuple of the (min_value, max_value) form representing the
range of the column type bound to the field.
)integer_field_ranges)r)   r~   s     r*   integer_field_range*BaseDatabaseOperations.integer_field_range  s     ((77r-   c                     U R                   R                  R                  (       a  Uu  pEUu  pgSU< SU< S3/ UQUQ74$ [        SU-  5      e)Nr   z - r   z-This backend does not support %s subtraction.)r'   r  supports_temporal_subtractionr   )r)   r~   lhsrhslhs_sql
lhs_paramsrhs_sql
rhs_paramss           r*   subtract_temporals)BaseDatabaseOperations.subtract_temporals  sW    ??##AA"%G"%GZ")735Oz5OJ5OOO;mK
 	
r-   c                     [        U[        5      (       aB  US:X  a  U R                  $ US:  a  S[        U5      U R                  4-  $ SXR
                  4-  $ g )Nr   z%d %s)r   intCURRENT_ROWabsr#   r$   r   s     r*   window_frame_value)BaseDatabaseOperations.window_frame_value  sX    eS!!z'''#e*dnn!===%!888 "r-   c                    [        U[        5      (       a%  [        U[        5      (       a  X:  a  [        S5      eUb$  [        U[        5      (       d  [        SU S35      eUb$  [        U[        5      (       d  [        SU S35      eU R                  U5      =(       d    U R                  nU R                  U5      =(       d    U R
                  nX44$ )zE
Return SQL for start and end points in an OVER clause window frame.
z!start cannot be greater than end.z;start argument must be an integer, zero, or None, but got 'z'.z9end argument must be an integer, zero, or None, but got ')r   r  rM  r  UNBOUNDED_PRECEDINGUNBOUNDED_FOLLOWING)r)   startendstart_end_s        r*   window_frame_rows_start_end2BaseDatabaseOperations.window_frame_rows_start_end  s     eS!!jc&:&:u{@AAZs%;%;MeWTVW  ?:c3#7#7KC5PRS  ((/K43K3K&&s+Gt/G/G|r-   c                 b   Ub  [        U[        5      (       a  [        U[        5      (       a  US:  a  [        SU-  5      eUb  [        U[        5      (       a  [        U[        5      (       a  US:  a  [        SU-  5      eU R                  U5      =(       d    U R                  nU R                  U5      =(       d    U R
                  nU R                  R                  nUR                  (       a<  U(       a  US:  d  U(       a(  US:  a"  [        SU R                  R                  -  5      eX44$ )Nr   zGstart argument must be a negative integer, zero, or None, but got '%s'.zEend argument must be a positive integer, zero, or None, but got '%s'.zA%s only supports UNBOUNDED together with PRECEDING and FOLLOWING.)r   r  rM  r  r  r  r'   r  4only_supports_unbounded_with_preceding_and_followingr   display_name)r)   r  r  r  r  r  s         r*   window_frame_range_start_end3BaseDatabaseOperations.window_frame_range_start_end  s   j&<&<uc""uqy "'(  OJsC$8$8sC  S1WW  ((/K43K3K&&s+Gt/G/G??++HHuqyccAg##;;<  |r-   c           	         U R                   R                  R                  (       d  [        S5      eU(       a  U R                   R                  R                  nUR                  5       nXC;  aU  SU-  nU(       a!  USSR                  [        U5      5      -  -  nOUSU R                   R                   S3-  n[        U5      eU(       a4  [        SSR                  [        UR                  5       5      5      -  5      eU R                  $ )Nz9This backend does not support explaining query execution.z%s is not a recognized format.z Allowed formats: %sr   r   z does not support any formats.zUnknown options: %s)r'   r  #supports_explaining_query_executionr   supported_explain_formatsupperr   sortedr  rM  keysexplain_prefix)r)   r   optionssupported_formatsnormalized_formatmsgs         r*   explain_query_prefix+BaseDatabaseOperations.explain_query_prefix  s    ''KK#K   $ 8 8 R R & 969JJ$1DIIfEV>W4XXXCDOO8899WXC !o%2TYYvglln?U5VVWW"""r-   c                     g)NzINSERT INTOr/   )r)   on_conflicts     r*   insert_statement'BaseDatabaseOperations.insert_statement  s    r-   c                     g)Nrl   r/   )r)   r6   r  update_fieldsunique_fieldss        r*   on_conflict_suffix_sql-BaseDatabaseOperations.on_conflict_suffix_sql  s    r-   c                 4    [        X5      n[        X45      nXV4$ r&   r   )r)   	lhs_table	lhs_field	rhs_table	rhs_fieldlhs_exprrhs_exprs          r*   prepare_join_on_clause-BaseDatabaseOperations.prepare_join_on_clause"  s    y,y,!!r-   )r(   r'   r&   )FFr/   F)T)F)NN)___name__
__module____qualname____firstlineno____doc__r   r  set_operatorscast_data_types"cast_char_field_without_max_lengthr#   r$   r  r  r  r  r+   r2   r8   r>   rD   rI   rP   rU   rY   r\   r_   rc   rf   ri   rn   rr   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rC   r   r   r   r   r  r	  r  r  r  r   r$  r)  r1  prep_for_iexact_queryr4  r@  rC  r:  r8  r<  r?  rU  r\  rh  rr  rw  rz  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __static_attributes__r/   r-   r*   r   r      s   
 6O
 -1F#;%/ /).C
 #M O)-& II&2&2K N
	U



	
	

?$! 	


&
<0 

3

5=A ;@u 
((	T 0&	F.*23	*C8
9$6#*"r-   r   )r7  r=  rY  r{   	importlibr   r   django.confr   	django.dbr   r   django.db.backendsr   django.db.models.expressionsr	   django.utilsr
   django.utils.deprecationr   django.utils.encodingr   r   r/   r-   r*   <module>r     s8        #    4 $ , ! = +T" T"r-   