Commit f943e2e4 authored by Malcolm Tredinnick's avatar Malcolm Tredinnick
Browse files

[1.0.X] Fixed #10357 -- Fixed the "dbshell" command for Windows users.

Thanks to markshep for the patch.

Backport of r10517 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10518 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent b6bd5ddc
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    executable_name = 'mysql'

    def runshell(self):
        args = ['']
        args = [self.executable_name]
        db = settings.DATABASE_OPTIONS.get('db', settings.DATABASE_NAME)
        user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
        passwd = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
@@ -28,4 +29,7 @@ class DatabaseClient(BaseDatabaseClient):
        if db:
            args += [db]

        if os.name == 'nt':
            sys.exit(os.system(" ".join(args)))
        else:
            os.execvp(self.executable_name, args)
+5 −1
Original line number Diff line number Diff line
from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    executable_name = 'sqlplus'
@@ -9,4 +10,7 @@ class DatabaseClient(BaseDatabaseClient):
        from django.db import connection
        conn_string = connection._connect_string(settings)
        args = [self.executable_name, "-L", conn_string]
        if os.name == 'nt':
            sys.exit(os.system(" ".join(args)))
        else:
            os.execvp(self.executable_name, args)
+5 −1
Original line number Diff line number Diff line
from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    executable_name = 'psql'
@@ -14,4 +15,7 @@ class DatabaseClient(BaseDatabaseClient):
        if settings.DATABASE_PORT:
            args.extend(["-p", str(settings.DATABASE_PORT)])
        args += [settings.DATABASE_NAME]
        if os.name == 'nt':
            sys.exit(os.system(" ".join(args)))
        else:
            os.execvp(self.executable_name, args)
+6 −2
Original line number Diff line number Diff line
from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    executable_name = 'sqlite3'

    def runshell(self):
        args = ['', settings.DATABASE_NAME]
        args = [self.executable_name, settings.DATABASE_NAME]
        if os.name == 'nt':
            sys.exit(os.system(" ".join(args)))
        else:
            os.execvp(self.executable_name, args)