mirror of https://github.com/django/django.git
Fixed #26140 -- Suppressed MySQL warning when inserting binary content
Thanks Tim Graham for the review.
This commit is contained in:
parent
cacc7e85e1
commit
204e00c0c5
|
@ -578,6 +578,13 @@ class BaseDatabaseOperations(object):
|
||||||
def combine_duration_expression(self, connector, sub_expressions):
|
def combine_duration_expression(self, connector, sub_expressions):
|
||||||
return self.combine_expression(connector, sub_expressions)
|
return self.combine_expression(connector, sub_expressions)
|
||||||
|
|
||||||
|
def binary_placeholder_sql(self, value):
|
||||||
|
"""
|
||||||
|
Some backends require special syntax to insert binary content (MySQL
|
||||||
|
for example uses '_binary %s').
|
||||||
|
"""
|
||||||
|
return '%s'
|
||||||
|
|
||||||
def modify_insert_params(self, placeholder, params):
|
def modify_insert_params(self, placeholder, params):
|
||||||
"""Allow modification of insert parameters. Needed for Oracle Spatial
|
"""Allow modification of insert parameters. Needed for Oracle Spatial
|
||||||
backend due to #10888.
|
backend due to #10888.
|
||||||
|
|
|
@ -212,6 +212,9 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||||
value = uuid.UUID(value)
|
value = uuid.UUID(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def binary_placeholder_sql(self, value):
|
||||||
|
return '_binary %s' if value is not None else '%s'
|
||||||
|
|
||||||
def subtract_temporals(self, internal_type, lhs, rhs):
|
def subtract_temporals(self, internal_type, lhs, rhs):
|
||||||
lhs_sql, lhs_params = lhs
|
lhs_sql, lhs_params = lhs
|
||||||
rhs_sql, rhs_params = rhs
|
rhs_sql, rhs_params = rhs
|
||||||
|
|
|
@ -2371,6 +2371,9 @@ class BinaryField(Field):
|
||||||
def get_internal_type(self):
|
def get_internal_type(self):
|
||||||
return "BinaryField"
|
return "BinaryField"
|
||||||
|
|
||||||
|
def get_placeholder(self, value, compiler, connection):
|
||||||
|
return connection.ops.binary_placeholder_sql(value)
|
||||||
|
|
||||||
def get_default(self):
|
def get_default(self):
|
||||||
if self.has_default() and not callable(self.default):
|
if self.has_default() and not callable(self.default):
|
||||||
return self.default
|
return self.default
|
||||||
|
|
Loading…
Reference in New Issue