Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
3957f767
Kaydet (Commit)
3957f767
authored
Eki 09, 2018
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Eki 09, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplified handling of DurationField values on MySQL/MariaDB.
üst
e90af8ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
operations.py
django/db/backends/mysql/operations.py
+1
-8
No files found.
django/db/backends/mysql/operations.py
Dosyayı görüntüle @
3957f767
import
decimal
import
uuid
from
django.conf
import
settings
...
...
@@ -262,12 +261,6 @@ class DatabaseOperations(BaseDatabaseOperations):
def
binary_placeholder_sql
(
self
,
value
):
return
'_binary
%
s'
if
value
is
not
None
and
not
hasattr
(
value
,
'as_sql'
)
else
'
%
s'
def
convert_durationfield_value
(
self
,
value
,
expression
,
connection
):
# DurationFields can return a Decimal in MariaDB.
if
isinstance
(
value
,
decimal
.
Decimal
):
value
=
float
(
value
)
return
super
()
.
convert_durationfield_value
(
value
,
expression
,
connection
)
def
subtract_temporals
(
self
,
internal_type
,
lhs
,
rhs
):
lhs_sql
,
lhs_params
=
lhs
rhs_sql
,
rhs_params
=
rhs
...
...
@@ -275,7 +268,7 @@ class DatabaseOperations(BaseDatabaseOperations):
if
self
.
connection
.
mysql_is_mariadb
:
# MariaDB includes the microsecond component in TIME_TO_SEC as
# a decimal. MySQL returns an integer without microseconds.
return
'
((TIME_TO_SEC(
%(lhs)
s) - TIME_TO_SEC(
%(rhs)
s)) * 1000000
)'
%
{
return
'
CAST((TIME_TO_SEC(
%(lhs)
s) - TIME_TO_SEC(
%(rhs)
s)) * 1000000 AS SIGNED
)'
%
{
'lhs'
:
lhs_sql
,
'rhs'
:
rhs_sql
},
lhs_params
+
rhs_params
return
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment