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
c5a25c27
Kaydet (Commit)
c5a25c27
authored
Ara 17, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add introspection support for BinaryField
üst
d680a3f4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
2 deletions
+10
-2
introspection.py
django/db/backends/oracle/introspection.py
+1
-0
introspection.py
django/db/backends/postgresql_psycopg2/introspection.py
+1
-0
introspection.py
django/db/backends/sqlite3/introspection.py
+1
-0
models.py
tests/introspection/models.py
+1
-0
tests.py
tests/introspection/tests.py
+6
-2
No files found.
django/db/backends/oracle/introspection.py
Dosyayı görüntüle @
c5a25c27
...
...
@@ -7,6 +7,7 @@ foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REF
class
DatabaseIntrospection
(
BaseDatabaseIntrospection
):
# Maps type objects to Django Field types.
data_types_reverse
=
{
cx_Oracle
.
BLOB
:
'BinaryField'
,
cx_Oracle
.
CLOB
:
'TextField'
,
cx_Oracle
.
DATETIME
:
'DateField'
,
cx_Oracle
.
FIXED_CHAR
:
'CharField'
,
...
...
django/db/backends/postgresql_psycopg2/introspection.py
Dosyayı görüntüle @
c5a25c27
...
...
@@ -7,6 +7,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse
=
{
16
:
'BooleanField'
,
17
:
'BinaryField'
,
20
:
'BigIntegerField'
,
21
:
'SmallIntegerField'
,
23
:
'IntegerField'
,
...
...
django/db/backends/sqlite3/introspection.py
Dosyayı görüntüle @
c5a25c27
...
...
@@ -30,6 +30,7 @@ class FlexibleFieldLookupDict(object):
'real'
:
'FloatField'
,
'text'
:
'TextField'
,
'char'
:
'CharField'
,
'blob'
:
'BinaryField'
,
'date'
:
'DateField'
,
'datetime'
:
'DateTimeField'
,
'time'
:
'TimeField'
,
...
...
tests/introspection/models.py
Dosyayı görüntüle @
c5a25c27
...
...
@@ -10,6 +10,7 @@ class Reporter(models.Model):
last_name
=
models
.
CharField
(
max_length
=
30
)
email
=
models
.
EmailField
()
facebook_user_id
=
models
.
BigIntegerField
(
null
=
True
)
raw_data
=
models
.
BinaryField
(
null
=
True
)
class
Meta
:
unique_together
=
(
'first_name'
,
'last_name'
)
...
...
tests/introspection/tests.py
Dosyayı görüntüle @
c5a25c27
...
...
@@ -60,9 +60,13 @@ class IntrospectionTests(TestCase):
def
test_get_table_description_types
(
self
):
cursor
=
connection
.
cursor
()
desc
=
connection
.
introspection
.
get_table_description
(
cursor
,
Reporter
.
_meta
.
db_table
)
# The MySQL exception is due to the cursor.description returning the same constant for
# text and blob columns. TODO: use information_schema database to retrieve the proper
# field type on MySQL
self
.
assertEqual
(
[
datatype
(
r
[
1
],
r
)
for
r
in
desc
],
[
'IntegerField'
,
'CharField'
,
'CharField'
,
'CharField'
,
'BigIntegerField'
]
[
'IntegerField'
,
'CharField'
,
'CharField'
,
'CharField'
,
'BigIntegerField'
,
'BinaryField'
if
connection
.
vendor
!=
'mysql'
else
'TextField'
]
)
# The following test fails on Oracle due to #17202 (can't correctly
...
...
@@ -85,7 +89,7 @@ class IntrospectionTests(TestCase):
desc
=
connection
.
introspection
.
get_table_description
(
cursor
,
Reporter
.
_meta
.
db_table
)
self
.
assertEqual
(
[
r
[
6
]
for
r
in
desc
],
[
False
,
False
,
False
,
False
,
True
]
[
False
,
False
,
False
,
False
,
True
,
True
]
)
# Regression test for #9991 - 'real' types in postgres
...
...
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