summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-11 11:50:21 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-11 11:50:21 +0000
commitf943e2e4181b6570d4d6f85b0e2dff311ae20597 (patch)
tree68de3b4eb61e843e9b205d21057f50c0a8418d6f
parentb6bd5ddc3357d99f22f5181f5daecb46512650ba (diff)
[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
-rw-r--r--django/db/backends/mysql/client.py8
-rw-r--r--django/db/backends/oracle/client.py6
-rw-r--r--django/db/backends/postgresql/client.py6
-rw-r--r--django/db/backends/sqlite3/client.py8
4 files changed, 22 insertions, 6 deletions
diff --git a/django/db/backends/mysql/client.py b/django/db/backends/mysql/client.py
index 17daca9fd6..4b6de03e9f 100644
--- a/django/db/backends/mysql/client.py
+++ b/django/db/backends/mysql/client.py
@@ -1,12 +1,13 @@
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]
- os.execvp(self.executable_name, args)
+ if os.name == 'nt':
+ sys.exit(os.system(" ".join(args)))
+ else:
+ os.execvp(self.executable_name, args)
diff --git a/django/db/backends/oracle/client.py b/django/db/backends/oracle/client.py
index c95b8109ba..dd6b765cc2 100644
--- a/django/db/backends/oracle/client.py
+++ b/django/db/backends/oracle/client.py
@@ -1,6 +1,7 @@
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]
- os.execvp(self.executable_name, args)
+ if os.name == 'nt':
+ sys.exit(os.system(" ".join(args)))
+ else:
+ os.execvp(self.executable_name, args)
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
index 03898c45da..2a94a09a85 100644
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -1,6 +1,7 @@
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]
- os.execvp(self.executable_name, args)
+ if os.name == 'nt':
+ sys.exit(os.system(" ".join(args)))
+ else:
+ os.execvp(self.executable_name, args)
diff --git a/django/db/backends/sqlite3/client.py b/django/db/backends/sqlite3/client.py
index 239e72f1e9..5e28e389d0 100644
--- a/django/db/backends/sqlite3/client.py
+++ b/django/db/backends/sqlite3/client.py
@@ -1,10 +1,14 @@
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]
- os.execvp(self.executable_name, args)
+ args = [self.executable_name, settings.DATABASE_NAME]
+ if os.name == 'nt':
+ sys.exit(os.system(" ".join(args)))
+ else:
+ os.execvp(self.executable_name, args)