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
e17f40f4
Kaydet (Commit)
e17f40f4
authored
Kas 30, 2016
tarafından
Mariusz Felisiak
Kaydeden (comit)
Tim Graham
Kas 30, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #24245 -- Added introspection for database defaults on Oracle.
üst
6f43b2b8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
10 deletions
+12
-10
introspection.py
django/db/backends/base/introspection.py
+1
-1
introspection.py
django/db/backends/mysql/introspection.py
+2
-2
features.py
django/db/backends/oracle/features.py
+0
-1
introspection.py
django/db/backends/oracle/introspection.py
+9
-1
introspection.py
django/db/backends/postgresql/introspection.py
+0
-3
introspection.py
django/db/backends/sqlite3/introspection.py
+0
-2
No files found.
django/db/backends/base/introspection.py
Dosyayı görüntüle @
e17f40f4
...
...
@@ -4,7 +4,7 @@ from collections import namedtuple
TableInfo
=
namedtuple
(
'TableInfo'
,
[
'name'
,
'type'
])
# Structure returned by the DB-API cursor.description interface (PEP 249)
FieldInfo
=
namedtuple
(
'FieldInfo'
,
'name type_code display_size internal_size precision scale null_ok'
)
FieldInfo
=
namedtuple
(
'FieldInfo'
,
'name type_code display_size internal_size precision scale null_ok
default
'
)
class
BaseDatabaseIntrospection
(
object
):
...
...
django/db/backends/mysql/introspection.py
Dosyayı görüntüle @
e17f40f4
...
...
@@ -10,7 +10,7 @@ from django.utils.datastructures import OrderedSet
from
django.utils.deprecation
import
RemovedInDjango21Warning
from
django.utils.encoding
import
force_text
FieldInfo
=
namedtuple
(
'FieldInfo'
,
FieldInfo
.
_fields
+
(
'extra'
,
'default'
))
FieldInfo
=
namedtuple
(
'FieldInfo'
,
FieldInfo
.
_fields
+
(
'extra'
,))
InfoLine
=
namedtuple
(
'InfoLine'
,
'col_name data_type max_len num_prec num_scale extra column_default'
)
...
...
@@ -89,8 +89,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
to_int
(
field_info
[
col_name
]
.
num_prec
)
or
line
[
4
],
to_int
(
field_info
[
col_name
]
.
num_scale
)
or
line
[
5
],
line
[
6
],
field_info
[
col_name
]
.
extra
,
field_info
[
col_name
]
.
column_default
,
field_info
[
col_name
]
.
extra
,
)
))
)
...
...
django/db/backends/oracle/features.py
Dosyayı görüntüle @
e17f40f4
...
...
@@ -22,7 +22,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
has_bulk_insert
=
True
supports_tablespaces
=
True
supports_sequence_reset
=
False
can_introspect_default
=
False
# Pending implementation by an interested person.
can_introspect_max_length
=
False
can_introspect_time_field
=
False
atomic_transactions
=
False
...
...
django/db/backends/oracle/introspection.py
Dosyayı görüntüle @
e17f40f4
...
...
@@ -60,6 +60,13 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
def
get_table_description
(
self
,
cursor
,
table_name
):
"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
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
()}
self
.
cache_bust_counter
+=
1
cursor
.
execute
(
"SELECT * FROM {} WHERE ROWNUM < 2 AND {} > 0"
.
format
(
self
.
connection
.
ops
.
quote_name
(
table_name
),
...
...
@@ -67,8 +74,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
]
name
=
name
%
{}
# cx_Oracle, for some reason, doubles percent signs.
description
.
append
(
FieldInfo
(
*
(
name
.
lower
(),)
+
desc
[
1
:]))
description
.
append
(
FieldInfo
(
*
(
name
.
lower
(),)
+
desc
[
1
:]
+
(
default
,)
))
return
description
def
table_name_converter
(
self
,
name
):
...
...
django/db/backends/postgresql/introspection.py
Dosyayı görüntüle @
e17f40f4
from
__future__
import
unicode_literals
import
warnings
from
collections
import
namedtuple
from
django.db.backends.base.introspection
import
(
BaseDatabaseIntrospection
,
FieldInfo
,
TableInfo
,
...
...
@@ -9,8 +8,6 @@ from django.db.backends.base.introspection import (
from
django.utils.deprecation
import
RemovedInDjango21Warning
from
django.utils.encoding
import
force_text
FieldInfo
=
namedtuple
(
'FieldInfo'
,
FieldInfo
.
_fields
+
(
'default'
,))
class
DatabaseIntrospection
(
BaseDatabaseIntrospection
):
# Maps type codes to Django Field types.
...
...
django/db/backends/sqlite3/introspection.py
Dosyayı görüntüle @
e17f40f4
import
re
import
warnings
from
collections
import
namedtuple
from
django.db.backends.base.introspection
import
(
BaseDatabaseIntrospection
,
FieldInfo
,
TableInfo
,
...
...
@@ -8,7 +7,6 @@ from django.db.backends.base.introspection import (
from
django.utils.deprecation
import
RemovedInDjango21Warning
field_size_re
=
re
.
compile
(
r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$'
)
FieldInfo
=
namedtuple
(
'FieldInfo'
,
FieldInfo
.
_fields
+
(
'default'
,))
def
get_field_size
(
name
):
...
...
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