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
9af6c975
Kaydet (Commit)
9af6c975
authored
Haz 01, 2017
tarafından
Mariusz Felisiak
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #26682 -- Added AutoField introspection on Oracle.
üst
924a89e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
features.py
django/db/backends/oracle/features.py
+1
-0
introspection.py
django/db/backends/oracle/introspection.py
+16
-7
2.0.txt
docs/releases/2.0.txt
+3
-0
No files found.
django/db/backends/oracle/features.py
Dosyayı görüntüle @
9af6c975
...
@@ -11,6 +11,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
...
@@ -11,6 +11,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
has_select_for_update_skip_locked
=
True
has_select_for_update_skip_locked
=
True
can_return_id_from_insert
=
True
can_return_id_from_insert
=
True
allow_sliced_subqueries
=
False
allow_sliced_subqueries
=
False
can_introspect_autofield
=
True
supports_subqueries_in_group_by
=
False
supports_subqueries_in_group_by
=
False
supports_transactions
=
True
supports_transactions
=
True
supports_timezones
=
False
supports_timezones
=
False
...
...
django/db/backends/oracle/introspection.py
Dosyayı görüntüle @
9af6c975
import
warnings
import
warnings
from
collections
import
namedtuple
import
cx_Oracle
import
cx_Oracle
from
django.db.backends.base.introspection
import
(
from
django.db.backends.base.introspection
import
(
BaseDatabaseIntrospection
,
FieldInfo
,
TableInfo
,
BaseDatabaseIntrospection
,
FieldInfo
as
BaseFieldInfo
,
TableInfo
,
)
)
from
django.utils.deprecation
import
RemovedInDjango21Warning
from
django.utils.deprecation
import
RemovedInDjango21Warning
FieldInfo
=
namedtuple
(
'FieldInfo'
,
BaseFieldInfo
.
_fields
+
(
'is_autofield'
,))
class
DatabaseIntrospection
(
BaseDatabaseIntrospection
):
class
DatabaseIntrospection
(
BaseDatabaseIntrospection
):
# Maps type objects to Django Field types.
# Maps type objects to Django Field types.
...
@@ -32,9 +35,11 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
...
@@ -32,9 +35,11 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
precision
,
scale
=
description
[
4
:
6
]
precision
,
scale
=
description
[
4
:
6
]
if
scale
==
0
:
if
scale
==
0
:
if
precision
>
11
:
if
precision
>
11
:
return
'BigIntegerField'
return
'Big
AutoField'
if
description
.
is_autofield
else
'Big
IntegerField'
elif
precision
==
1
:
elif
precision
==
1
:
return
'BooleanField'
return
'BooleanField'
elif
description
.
is_autofield
:
return
'AutoField'
else
:
else
:
return
'IntegerField'
return
'IntegerField'
elif
scale
==
-
127
:
elif
scale
==
-
127
:
...
@@ -61,12 +66,16 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
...
@@ -61,12 +66,16 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
CASE
CASE
WHEN char_used IS NULL THEN data_length
WHEN char_used IS NULL THEN data_length
ELSE char_length
ELSE char_length
END as internal_size
END as internal_size,
CASE
WHEN identity_column = 'YES' THEN 1
ELSE 0
END as is_autofield
FROM user_tab_cols
FROM user_tab_cols
WHERE table_name = UPPER(
%
s)"""
,
[
table_name
])
WHERE table_name = UPPER(
%
s)"""
,
[
table_name
])
field_map
=
{
field_map
=
{
column
:
(
internal_size
,
default
if
default
!=
'NULL'
else
None
)
column
:
(
internal_size
,
default
if
default
!=
'NULL'
else
None
,
is_autofield
)
for
column
,
default
,
internal_size
in
cursor
.
fetchall
()
for
column
,
default
,
internal_size
,
is_autofield
in
cursor
.
fetchall
()
}
}
self
.
cache_bust_counter
+=
1
self
.
cache_bust_counter
+=
1
cursor
.
execute
(
"SELECT * FROM {} WHERE ROWNUM < 2 AND {} > 0"
.
format
(
cursor
.
execute
(
"SELECT * FROM {} WHERE ROWNUM < 2 AND {} > 0"
.
format
(
...
@@ -75,14 +84,14 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
...
@@ -75,14 +84,14 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
description
=
[]
description
=
[]
for
desc
in
cursor
.
description
:
for
desc
in
cursor
.
description
:
name
=
desc
[
0
]
name
=
desc
[
0
]
internal_size
,
default
=
field_map
[
name
]
internal_size
,
default
,
is_autofield
=
field_map
[
name
]
name
=
name
%
{}
# cx_Oracle, for some reason, doubles percent signs.
name
=
name
%
{}
# cx_Oracle, for some reason, doubles percent signs.
description
.
append
(
FieldInfo
(
*
(
description
.
append
(
FieldInfo
(
*
(
(
name
.
lower
(),)
+
(
name
.
lower
(),)
+
desc
[
1
:
3
]
+
desc
[
1
:
3
]
+
(
internal_size
,
desc
[
4
]
or
0
,
desc
[
5
]
or
0
)
+
(
internal_size
,
desc
[
4
]
or
0
,
desc
[
5
]
or
0
)
+
desc
[
6
:]
+
desc
[
6
:]
+
(
default
,)
(
default
,
is_autofield
)
)))
)))
return
description
return
description
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
9af6c975
...
@@ -195,6 +195,9 @@ Management Commands
...
@@ -195,6 +195,9 @@ Management Commands
* The new :option:`diffsettings --output` option allows formatting the output
* The new :option:`diffsettings --output` option allows formatting the output
in a unified diff format.
in a unified diff format.
* On Oracle, :djadmin:`inspectdb` can now introspect ``AutoField`` if the
column is created as an identity column.
Migrations
Migrations
~~~~~~~~~~
~~~~~~~~~~
...
...
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