diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py
index 7465920..610fcd4 100644
a
|
b
|
class Command(BaseCommand):
|
11 | 11 | make_option('--database', action='store', dest='database', |
12 | 12 | default=DEFAULT_DB_ALIAS, help='Nominates a database onto which to ' |
13 | 13 | 'open a shell. Defaults to the "default" database.'), |
| 14 | make_option('--insecure', action='store_true', dest='insecure', |
| 15 | default=False, help='Allow insecure passing of password via environment' |
| 16 | ), |
14 | 17 | ) |
15 | 18 | |
16 | 19 | requires_model_validation = False |
… |
… |
class Command(BaseCommand):
|
18 | 21 | def handle(self, **options): |
19 | 22 | connection = connections[options.get('database')] |
20 | 23 | try: |
21 | | connection.client.runshell() |
| 24 | connection.client.runshell(insecure=options.get('insecure')) |
22 | 25 | except OSError: |
23 | 26 | # Note that we're assuming OSError means that the client program |
24 | 27 | # isn't installed. There's a possibility OSError would be raised |
diff --git a/django/db/backends/mysql/client.py b/django/db/backends/mysql/client.py
index 1cf8cee..b9b5702 100644
a
|
b
|
from django.db.backends import BaseDatabaseClient
|
6 | 6 | class DatabaseClient(BaseDatabaseClient): |
7 | 7 | executable_name = 'mysql' |
8 | 8 | |
9 | | def runshell(self): |
| 9 | def runshell(self, *args, **kwargs): |
10 | 10 | settings_dict = self.connection.settings_dict |
11 | 11 | args = [self.executable_name] |
12 | 12 | db = settings_dict['OPTIONS'].get('db', settings_dict['NAME']) |
diff --git a/django/db/backends/oracle/client.py b/django/db/backends/oracle/client.py
index ccc64eb..8f89964 100644
a
|
b
|
from django.db.backends import BaseDatabaseClient
|
6 | 6 | class DatabaseClient(BaseDatabaseClient): |
7 | 7 | executable_name = 'sqlplus' |
8 | 8 | |
9 | | def runshell(self): |
| 9 | def runshell(self, *args, **kwargs): |
10 | 10 | conn_string = self.connection._connect_string() |
11 | 11 | args = [self.executable_name, "-L", conn_string] |
12 | 12 | if os.name == 'nt': |
diff --git a/django/db/backends/postgresql_psycopg2/client.py b/django/db/backends/postgresql_psycopg2/client.py
index a5c0296..d0082cf 100644
a
|
b
|
from django.db.backends import BaseDatabaseClient
|
6 | 6 | class DatabaseClient(BaseDatabaseClient): |
7 | 7 | executable_name = 'psql' |
8 | 8 | |
9 | | def runshell(self): |
| 9 | def runshell(self, insecure=False, **kwargs): |
10 | 10 | settings_dict = self.connection.settings_dict |
11 | 11 | args = [self.executable_name] |
12 | 12 | if settings_dict['USER']: |
… |
… |
class DatabaseClient(BaseDatabaseClient):
|
15 | 15 | args.extend(["-h", settings_dict['HOST']]) |
16 | 16 | if settings_dict['PORT']: |
17 | 17 | args.extend(["-p", str(settings_dict['PORT'])]) |
| 18 | if insecure and settings_dict['PASSWORD']: |
| 19 | os.environ['PGPASSWORD'] = settings_dict['PASSWORD'] |
18 | 20 | args += [settings_dict['NAME']] |
19 | 21 | if os.name == 'nt': |
20 | 22 | sys.exit(os.system(" ".join(args))) |
diff --git a/django/db/backends/sqlite3/client.py b/django/db/backends/sqlite3/client.py
index 5b5b732..fa2d887 100644
a
|
b
|
from django.db.backends import BaseDatabaseClient
|
6 | 6 | class DatabaseClient(BaseDatabaseClient): |
7 | 7 | executable_name = 'sqlite3' |
8 | 8 | |
9 | | def runshell(self): |
| 9 | def runshell(self, *args, **kwargs): |
10 | 10 | args = [self.executable_name, |
11 | 11 | self.connection.settings_dict['NAME']] |
12 | 12 | if os.name == 'nt': |