Commit 99d9fa32 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Added feature flags for introspection capabilities.

parent cff59bed
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -518,6 +518,8 @@ class BaseDatabaseFeatures(object):
    supports_subqueries_in_group_by = True
    supports_bitwise_or = True

    supports_boolean_type = True

    supports_binary_field = True

    # Do time/datetime fields have microsecond precision?
@@ -562,6 +564,9 @@ class BaseDatabaseFeatures(object):
    # Does the backend reset sequences between tests?
    supports_sequence_reset = True

    # Can the backend determine reliably the length of a CharField?
    can_introspect_max_length = True

    # Confirm support for introspected foreign keys
    # Every database can do this reliably, except MySQL,
    # which can't do it for MyISAM tables
@@ -570,6 +575,24 @@ class BaseDatabaseFeatures(object):
    # Can the backend introspect an AutoField, instead of an IntegerField?
    can_introspect_autofield = False

    # Can the backend introspect a BigIntegerField, instead of an IntegerField?
    can_introspect_big_integer_field = True

    # Can the backend introspect an BinaryField, instead of an TextField?
    can_introspect_binary_field = True

    # Can the backend introspect an IPAddressField, instead of an CharField?
    can_introspect_ip_address_field = False

    # Can the backend introspect a PositiveIntegerField, instead of an IntegerField?
    can_introspect_positive_integer_field = False

    # Can the backend introspect a SmallIntegerField, instead of an IntegerField?
    can_introspect_small_integer_field = False

    # Can the backend introspect a TimeField, instead of a DateTimeField?
    can_introspect_time_field = True

    # Support for the DISTINCT ON clause
    can_distinct_on_fields = False

@@ -616,6 +639,8 @@ class BaseDatabaseFeatures(object):
    # Suffix for backends that don't support "SELECT xxx;" queries.
    bare_select_suffix = ''

    lowercases_column_names = False

    def __init__(self, connection):
        self.connection = connection

+2 −0
Original line number Diff line number Diff line
@@ -172,11 +172,13 @@ class DatabaseFeatures(BaseDatabaseFeatures):
    has_select_for_update_nowait = False
    supports_forward_references = False
    supports_long_model_names = False
    supports_boolean_type = False
    # XXX MySQL DB-API drivers currently fail on binary data on Python 3.
    supports_binary_field = six.PY2
    supports_microsecond_precision = False
    supports_regex_backreferencing = False
    supports_date_lookup_using_string = False
    can_introspect_binary_field = False
    supports_timezones = False
    requires_explicit_null_ordering_when_grouping = True
    allows_auto_pk_0 = False
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
    has_bulk_insert = True
    supports_tablespaces = True
    supports_sequence_reset = False
    can_introspect_max_length = False
    can_introspect_time_field = False
    atomic_transactions = False
    supports_combined_alters = False
    nulls_order_largest = True
@@ -118,6 +120,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
    connection_persists_old_columns = True
    closed_cursor_error_class = InterfaceError
    bare_select_suffix = " FROM DUAL"
    lowercases_column_names = True


class DatabaseOperations(BaseDatabaseOperations):
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
    uses_savepoints = True
    supports_tablespaces = True
    supports_transactions = True
    can_introspect_ip_address_field = True
    can_introspect_small_integer_field = True
    can_distinct_on_fields = True
    can_rollback_ddl = True
    supports_combined_alters = True
+2 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
    supports_foreign_keys = False
    supports_check_constraints = False
    autocommits_when_autocommit_is_off = True
    can_introspect_positive_integer_field = True
    can_introspect_small_integer_field = True
    supports_transactions = True
    atomic_transactions = False
    can_rollback_ddl = True
Loading