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
c6525bea
Kaydet (Commit)
c6525bea
authored
Eki 25, 2018
tarafından
Mariusz Felisiak
Kaydeden (comit)
Tim Graham
Eki 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29534 -- Made dbshell use rlwrap on Oracle if available.
üst
9a88c6dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
client.py
django/db/backends/oracle/client.py
+5
-0
2.2.txt
docs/releases/2.2.txt
+3
-0
test_oracle.py
tests/dbshell/test_oracle.py
+33
-0
No files found.
django/db/backends/oracle/client.py
Dosyayı görüntüle @
c6525bea
import
shutil
import
subprocess
from
django.db.backends.base.client
import
BaseDatabaseClient
...
...
@@ -5,8 +6,12 @@ from django.db.backends.base.client import BaseDatabaseClient
class
DatabaseClient
(
BaseDatabaseClient
):
executable_name
=
'sqlplus'
wrapper_name
=
'rlwrap'
def
runshell
(
self
):
conn_string
=
self
.
connection
.
_connect_string
()
args
=
[
self
.
executable_name
,
"-L"
,
conn_string
]
wrapper_path
=
shutil
.
which
(
self
.
wrapper_name
)
if
wrapper_path
:
args
=
[
wrapper_path
,
*
args
]
subprocess
.
check_call
(
args
)
docs/releases/2.2.txt
Dosyayı görüntüle @
c6525bea
...
...
@@ -185,6 +185,9 @@ Management Commands
* :djadmin:`inspectdb` now introspects :class:`~django.db.models.DurationField`
for Oracle and PostgreSQL.
* On Oracle, :djadmin:`dbshell` is wrapped with ``rlwrap``, if available.
``rlwrap`` provides a command history and editing of keyboard input.
Migrations
~~~~~~~~~~
...
...
tests/dbshell/test_oracle.py
0 → 100644
Dosyayı görüntüle @
c6525bea
from
unittest
import
mock
,
skipUnless
from
django.db
import
connection
from
django.db.backends.oracle.client
import
DatabaseClient
from
django.test
import
SimpleTestCase
@skipUnless
(
connection
.
vendor
==
'oracle'
,
'Oracle tests'
)
class
OracleDbshellTests
(
SimpleTestCase
):
def
_run_dbshell
(
self
,
rlwrap
=
False
):
"""Run runshell command and capture its arguments."""
def
_mock_subprocess_call
(
*
args
):
self
.
subprocess_args
=
tuple
(
*
args
)
return
0
client
=
DatabaseClient
(
connection
)
self
.
subprocess_args
=
None
with
mock
.
patch
(
'subprocess.call'
,
new
=
_mock_subprocess_call
):
with
mock
.
patch
(
'shutil.which'
,
return_value
=
'/usr/bin/rlwrap'
if
rlwrap
else
None
):
client
.
runshell
()
return
self
.
subprocess_args
def
test_without_rlwrap
(
self
):
self
.
assertEqual
(
self
.
_run_dbshell
(
rlwrap
=
False
),
(
'sqlplus'
,
'-L'
,
connection
.
_connect_string
()),
)
def
test_with_rlwrap
(
self
):
self
.
assertEqual
(
self
.
_run_dbshell
(
rlwrap
=
True
),
(
'/usr/bin/rlwrap'
,
'sqlplus'
,
'-L'
,
connection
.
_connect_string
()),
)
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