mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #27561 -- Added Oracle support for binary "or" operator.
Removed DatabaseFeatures.supports_bitwise_or feature (unused, always True).
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							7ed456063b
						
					
				
				
					commit
					b059ddf066
				
			| @@ -57,7 +57,6 @@ class BaseDatabaseFeatures(object): | ||||
|     # Is there a REAL datatype in addition to floats/doubles? | ||||
|     has_real_datatype = False | ||||
|     supports_subqueries_in_group_by = True | ||||
|     supports_bitwise_or = True | ||||
|  | ||||
|     # Is there a true datatype for uuid? | ||||
|     has_native_uuid_field = False | ||||
|   | ||||
| @@ -14,7 +14,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): | ||||
|     supports_subqueries_in_group_by = False | ||||
|     supports_transactions = True | ||||
|     supports_timezones = False | ||||
|     supports_bitwise_or = False | ||||
|     has_native_duration_field = True | ||||
|     can_defer_constraint_checks = True | ||||
|     supports_partially_nullable_unique_constraints = False | ||||
|   | ||||
| @@ -442,7 +442,8 @@ WHEN (new.%(col_name)s IS NULL) | ||||
|         elif connector == '&': | ||||
|             return 'BITAND(%s)' % ','.join(sub_expressions) | ||||
|         elif connector == '|': | ||||
|             raise NotImplementedError("Bit-wise or is not supported in Oracle.") | ||||
|             lhs, rhs = sub_expressions | ||||
|             return 'BITAND(-%(lhs)s-1,%(rhs)s)+%(lhs)s' % {'lhs': lhs, 'rhs': rhs} | ||||
|         elif connector == '^': | ||||
|             return 'POWER(%s)' % ','.join(sub_expressions) | ||||
|         return super(DatabaseOperations, self).combine_expression(connector, sub_expressions) | ||||
|   | ||||
| @@ -741,7 +741,6 @@ class ExpressionOperatorTests(TestCase): | ||||
|         self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 40) | ||||
|         self.assertEqual(Number.objects.get(pk=self.n.pk).float, Approximate(15.500, places=3)) | ||||
|  | ||||
|     @skipUnlessDBFeature('supports_bitwise_or') | ||||
|     def test_lefthand_bitwise_or(self): | ||||
|         # LH Bitwise or on integers | ||||
|         Number.objects.filter(pk=self.n.pk).update(integer=F('integer').bitor(48)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user