1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #29534 -- Made dbshell use rlwrap on Oracle if available.

This commit is contained in:
Mariusz Felisiak
2018-10-26 01:39:42 +02:00
committed by Tim Graham
parent 9a88c6dd6a
commit c6525bea9e
3 changed files with 41 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
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)