U
     5i                     @   s`   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 ddl
mZ G dd	 d	eZdS )
    N)transaction)BaseDatabaseFeatures)OperationalError)cached_property   )Databasec                       s   e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZejdkZdZejdkZeZejdkZejdkZejdkZejd	kZejd
kZdZdZ ddddZ!e"dd Z#e"dd Z$e" fddZ%e"dd Z&e'e()dZ*e'e()dZ+e"dd Z,e'e()dZ-  Z.S )DatabaseFeaturesTFi     )r	      r   )r	      r   )r	      r   r	      r   )r	      r   )r	   r   r   Znocasebinary)cicsZnon_defaultc                 C   s\   dhddddhdhddd	d
hd}t jdk r<|ddhi | j rX|dddhi |S )NzZmodel_fields.test_decimalfield.DecimalFieldTests.test_fetch_from_db_without_float_roundingz<schema.tests.SchemaTests.test_unique_no_unnecessary_fk_dropsz4schema.tests.SchemaTests.test_unique_and_reverse_m2mzHschema.tests.SchemaTests.test_alter_field_default_doesnt_perform_querieszKschema.tests.SchemaTests.test_rename_column_renames_deferred_sql_referenceszMmodel_fields.test_integerfield.PositiveIntegerFieldTests.test_negative_valueszIdb_functions.math.test_round.RoundTests.test_null_with_negative_precisionzLdb_functions.math.test_round.RoundTests.test_decimal_with_negative_precisionzJdb_functions.math.test_round.RoundTests.test_float_with_negative_precisionzLdb_functions.math.test_round.RoundTests.test_integer_with_negative_precision)z6SQLite stores values rounded to 15 significant digits.z5SQLite naively remakes the table on field alteration.z!SQLite doesn't have a constraint.z6SQLite doesn't support negative precision for ROUND().)r	      z*Nondeterministic failure on SQLite < 3.27.zIexpressions_window.tests.WindowFunctionTests.test_subquery_row_range_rankzOthe sqlite backend's close() method is a no-op when using an in-memory databasezJservers.test_liveserverthread.LiveServerThreadTest.test_closes_connectionszGservers.tests.LiveServerTestCloseConnectionTest.test_closes_connections)r   sqlite_version_infoupdate
connectionZis_in_memory_db)selfskips r   G/tmp/pip-unpacked-wheel-gcyiijx6/django/db/backends/sqlite3/features.pydjango_test_skips5   s:    

z"DatabaseFeatures.django_test_skipsc                 C   s*   t  d dr tjdkr dS tjdkS )Nr   z10.15.r   F)r	      r   )platformmac_ver
startswithr   r   r   r   r   r   !supports_atomic_references_rename[   s    z2DatabaseFeatures.supports_atomic_references_renamec                    s   t  jdddddS )NZ	AutoFieldZBigIntegerFieldZ	CharField)ZBigAutoFieldZDurationFieldZGenericIPAddressFieldZSmallAutoField)superintrospected_field_typesr    	__class__r   r   r#   c   s    z)DatabaseFeatures.introspected_field_typesc              
   C   sd   | j  P}z(t| j j |d W 5 Q R X W n  tk
rT   Y W 5 Q R  dS X W 5 Q R X dS )NzSELECT JSON('{"a": "b"}')FT)r   cursorr   Zatomicaliasexecuter   )r   r&   r   r   r   supports_json_fieldm   s    z$DatabaseFeatures.supports_json_fieldr)   c                 C   s
   t jdkS )N)r	   #   )r   r   r    r   r   r   can_return_columns_from_insertz   s    z/DatabaseFeatures.can_return_columns_from_insertr+   )/__name__
__module____qualname__Zcan_use_chunked_readsZ#test_db_allows_multiple_connectionsZsupports_unspecified_pkZsupports_timezonesZmax_query_paramsZ(supports_mixed_date_datetime_comparisonsZsupports_transactionsZatomic_transactionsZcan_rollback_ddlZcan_create_inline_fkZsupports_paramstyle_pyformatZcan_clone_databasesZsupports_temporal_subtractionZignores_table_name_caseZsupports_cast_with_precisionZtime_cast_precisionZcan_release_savepointsr   r   Zcan_alter_table_rename_columnZ supports_parentheses_in_compoundZ!supports_pragma_foreign_key_checkZcan_defer_constraint_checksZ%supports_functions_in_partial_indexesZsupports_over_clauseZ#supports_frame_range_fixed_distanceZ supports_aggregate_filter_clauseZ supports_order_by_nulls_modifierZorder_by_nulls_firstZsupports_json_field_containsZtest_collationsr   r   r!   r#   r)   propertyoperator
attrgetterZcan_introspect_json_fieldZhas_json_object_functionr+   Z can_return_rows_from_bulk_insert__classcell__r   r   r$   r   r      sZ   







%
	
	
r   )r0   r   Z	django.dbr   Z django.db.backends.base.featuresr   Zdjango.db.utilsr   Zdjango.utils.functionalr   baser   r   r   r   r   r   <module>   s   