mirror of
https://github.com/django/django.git
synced 2025-09-14 06:25:15 +00:00
Fixed #17027 -- Added support for the power operator in F expressions.
Thanks dan at dlo.me for the initial patch. - Added __pow__ and __rpow__ to ExpressionNode - Added oracle and mysql specific power expressions - Added used-defined power function for sqlite
This commit is contained in:
parent
1597503a01
commit
5240b83462
9 changed files with 56 additions and 2 deletions
|
@ -386,6 +386,14 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|||
items_sql = "(%s)" % ", ".join(["%s"] * len(fields))
|
||||
return "VALUES " + ", ".join([items_sql] * num_values)
|
||||
|
||||
def combine_expression(self, connector, sub_expressions):
|
||||
"""
|
||||
MySQL requires special cases for ^ operators in query expressions
|
||||
"""
|
||||
if connector == '^':
|
||||
return 'POW(%s)' % ','.join(sub_expressions)
|
||||
return super(DatabaseOperations, self).combine_expression(connector, sub_expressions)
|
||||
|
||||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
vendor = 'mysql'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue