mirror of
https://github.com/django/django.git
synced 2025-09-09 20:16:32 +00:00
Fixed #19716 -- Added support for microseconds with MySQL 5.6.4 and up
Thanks erik@cederstrand.dk for the report and Tim Graham for the review.
This commit is contained in:
parent
9e746c13e8
commit
22da5f8817
4 changed files with 42 additions and 8 deletions
|
@ -79,7 +79,7 @@ def adapt_datetime_with_timezone_support(value, conv):
|
|||
default_timezone = timezone.get_default_timezone()
|
||||
value = timezone.make_aware(value, default_timezone)
|
||||
value = value.astimezone(timezone.utc).replace(tzinfo=None)
|
||||
return Thing2Literal(value.strftime("%Y-%m-%d %H:%M:%S"), conv)
|
||||
return Thing2Literal(value.strftime("%Y-%m-%d %H:%M:%S.%f"), conv)
|
||||
|
||||
# MySQLdb-1.2.1 returns TIME columns as timedelta -- they are more like
|
||||
# timedelta in terms of actual behavior as they are signed and include days --
|
||||
|
@ -175,7 +175,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||
supports_forward_references = 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
|
||||
|
@ -210,6 +209,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||
"Confirm support for introspected foreign keys"
|
||||
return self._mysql_storage_engine != 'MyISAM'
|
||||
|
||||
@cached_property
|
||||
def supports_microsecond_precision(self):
|
||||
return self.connection.mysql_version >= (5, 6, 4)
|
||||
|
||||
@cached_property
|
||||
def has_zoneinfo_database(self):
|
||||
# MySQL accepts full time zones names (eg. Africa/Nairobi) but rejects
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue