Ticket #25912: added_bit_wise_shift_oprators.diff

File added_bit_wise_shift_oprators.diff, 2.9 KB (added by anabelensc, 8 years ago)
  • django/db/backends/base/features.py

    diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
    index 0951647..ac952d0 100644
    a b class BaseDatabaseFeatures(object):  
    5757    has_real_datatype = False
    5858    supports_subqueries_in_group_by = True
    5959    supports_bitwise_or = True
     60    supports_bitwise_leftshift = True
     61    supports_bitwise_rightshift = True
    6062
    6163    # Is there a true datatype for uuid?
    6264    has_native_uuid_field = False
  • django/db/backends/oracle/features.py

    diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py
    index 1ef0f23..5ca1a27 100644
    a b class DatabaseFeatures(BaseDatabaseFeatures):  
    2020    supports_timezones = False
    2121    has_zoneinfo_database = pytz is not None
    2222    supports_bitwise_or = False
     23    supports_bitwise_leftshift = False
     24    supports_bitwise_rightshift = False
    2325    has_native_duration_field = True
    2426    can_defer_constraint_checks = True
    2527    supports_partially_nullable_unique_constraints = False
  • django/db/backends/oracle/operations.py

    diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py
    index 0651105..19e02ce 100644
    a b WHEN (new.%(col_name)s IS NULL)  
    430430            return 'BITAND(%s)' % ','.join(sub_expressions)
    431431        elif connector == '|':
    432432            raise NotImplementedError("Bit-wise or is not supported in Oracle.")
     433        elif connector == '<<':
     434            raise NotImplementedError("Bit-wise left shift is not supported in Oracle.")
     435        elif connector == '>>':
     436            raise NotImplementedError("Bit-wise right shift is not supported in Oracle.")
    433437        elif connector == '^':
    434438            return 'POWER(%s)' % ','.join(sub_expressions)
    435439        return super(DatabaseOperations, self).combine_expression(connector, sub_expressions)
  • tests/expressions/tests.py

    diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
    index 9a1d930..334ffa2 100644
    a b class ExpressionOperatorTests(TestCase):  
    604604        self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 40)
    605605        self.assertEqual(Number.objects.get(pk=self.n.pk).float, Approximate(15.500, places=3))
    606606
     607    @skipUnlessDBFeature('supports_bitwise_leftshift')
    607608    def test_lefthand_bitwise_binary_left_shift_operator(self):
    608609        Number.objects.filter(pk=self.n.pk).update(integer=F('integer').bitleftshift(2))
    609610        self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 168)
    610611
     612    @skipUnlessDBFeature('supports_bitwise_rightshift')
    611613    def test_lefthand_bitwise_binary_right_shift_operator(self):
    612614        Number.objects.filter(pk=self.n.pk).update(integer=F('integer').bitrightshift(2))
    613615        self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 10)
Back to Top