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
51028f50
Kaydet (Commit)
51028f50
authored
Nis 01, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed getting max_digits for MySQL decimal fields
Refs #5014.
üst
a01361b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
introspection.py
django/db/backends/mysql/introspection.py
+10
-1
tests.py
tests/inspectdb/tests.py
+0
-2
No files found.
django/db/backends/mysql/introspection.py
Dosyayı görüntüle @
51028f50
...
...
@@ -47,8 +47,17 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
AND character_maximum_length IS NOT NULL"""
,
[
table_name
])
length_map
=
dict
(
cursor
.
fetchall
())
# Also getting precision and scale from information_schema (see #5014)
cursor
.
execute
(
"""
SELECT column_name, numeric_precision, numeric_scale FROM information_schema.columns
WHERE table_name =
%
s AND table_schema = DATABASE()
AND data_type='decimal'"""
,
[
table_name
])
numeric_map
=
dict
([(
line
[
0
],
tuple
([
int
(
n
)
for
n
in
line
[
1
:]]))
for
line
in
cursor
.
fetchall
()])
cursor
.
execute
(
"SELECT * FROM
%
s LIMIT 1"
%
self
.
connection
.
ops
.
quote_name
(
table_name
))
return
[
FieldInfo
(
*
(
line
[:
3
]
+
(
length_map
.
get
(
line
[
0
],
line
[
3
]),)
+
line
[
4
:]))
return
[
FieldInfo
(
*
(
line
[:
3
]
+
(
length_map
.
get
(
line
[
0
],
line
[
3
]),)
+
numeric_map
.
get
(
line
[
0
],
line
[
4
:
6
])
+
(
line
[
6
],)))
for
line
in
cursor
.
description
]
def
_name_to_index
(
self
,
cursor
,
table_name
):
...
...
tests/inspectdb/tests.py
Dosyayı görüntüle @
51028f50
...
...
@@ -57,8 +57,6 @@ class InspectDBTestCase(TestCase):
if
connection
.
vendor
==
'sqlite'
:
# Ticket #5014
assertFieldType
(
'decimal_field'
,
"models.DecimalField(max_digits=None, decimal_places=None)"
)
elif
connection
.
vendor
==
'mysql'
:
pass
# Ticket #5014
else
:
assertFieldType
(
'decimal_field'
,
"models.DecimalField(max_digits=6, decimal_places=1)"
)
assertFieldType
(
'email_field'
,
"models.CharField(max_length=75)"
)
...
...
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