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
3e43d24a
Kaydet (Commit)
3e43d24a
authored
Ara 19, 2016
tarafından
Mariusz Felisiak
Kaydeden (comit)
Tim Graham
Ara 19, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #19884 -- Added CharField max_length introspection on Oracle.
üst
e2112a5e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
features.py
django/db/backends/oracle/features.py
+0
-1
introspection.py
django/db/backends/oracle/introspection.py
+13
-5
tests.py
tests/inspectdb/tests.py
+0
-1
tests.py
tests/introspection/tests.py
+0
-2
No files found.
django/db/backends/oracle/features.py
Dosyayı görüntüle @
3e43d24a
...
...
@@ -21,7 +21,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
has_bulk_insert
=
True
supports_tablespaces
=
True
supports_sequence_reset
=
False
can_introspect_max_length
=
False
can_introspect_time_field
=
False
atomic_transactions
=
False
supports_combined_alters
=
False
...
...
django/db/backends/oracle/introspection.py
Dosyayı görüntüle @
3e43d24a
...
...
@@ -62,11 +62,19 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
"Returns a description of the table, with the DB-API cursor.description interface."
# user_tab_columns gives data default for columns
cursor
.
execute
(
"""
SELECT column_name, data_default
SELECT
column_name,
data_default,
CASE
WHEN char_used IS NULL THEN data_length
ELSE char_length
END as internal_size
FROM user_tab_cols
WHERE table_name = UPPER(
%
s)"""
,
[
table_name
])
columns_default
=
{
column
:
default
if
default
!=
'NULL'
else
None
for
column
,
default
in
cursor
.
fetchall
()}
field_map
=
{
column
:
(
internal_size
,
default
if
default
!=
'NULL'
else
None
)
for
column
,
default
,
internal_size
in
cursor
.
fetchall
()
}
self
.
cache_bust_counter
+=
1
cursor
.
execute
(
"SELECT * FROM {} WHERE ROWNUM < 2 AND {} > 0"
.
format
(
self
.
connection
.
ops
.
quote_name
(
table_name
),
...
...
@@ -74,9 +82,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
description
=
[]
for
desc
in
cursor
.
description
:
name
=
force_text
(
desc
[
0
])
# cx_Oracle always returns a 'str' on both Python 2 and 3
default
=
columns_default
[
name
]
internal_size
,
default
=
field_map
[
name
]
name
=
name
%
{}
# cx_Oracle, for some reason, doubles percent signs.
description
.
append
(
FieldInfo
(
*
(
name
.
lower
(),)
+
desc
[
1
:]
+
(
default
,)))
description
.
append
(
FieldInfo
(
*
(
name
.
lower
(),)
+
desc
[
1
:
3
]
+
(
internal_size
,)
+
desc
[
4
:
]
+
(
default
,)))
return
description
def
table_name_converter
(
self
,
name
):
...
...
tests/inspectdb/tests.py
Dosyayı görüntüle @
3e43d24a
...
...
@@ -58,7 +58,6 @@ class InspectDBTestCase(TestCase):
assertFieldType
=
self
.
make_field_type_asserter
()
# Inspecting Oracle DB doesn't produce correct results (#19884):
# - it gets max_length wrong: it returns a number of bytes.
# - it reports fields as blank=True when they aren't.
if
(
connection
.
features
.
can_introspect_max_length
and
not
connection
.
features
.
interprets_empty_strings_as_nulls
):
...
...
tests/introspection/tests.py
Dosyayı görüntüle @
3e43d24a
...
...
@@ -83,8 +83,6 @@ class IntrospectionTests(TransactionTestCase):
'SmallIntegerField'
if
connection
.
features
.
can_introspect_small_integer_field
else
'IntegerField'
]
)
# The following test fails on Oracle due to #17202 (can't correctly
# inspect the length of character columns).
@skipUnlessDBFeature
(
'can_introspect_max_length'
)
def
test_get_table_description_col_lengths
(
self
):
with
connection
.
cursor
()
as
cursor
:
...
...
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