Author: mtredinnick
Date: 2009-04-11 06:50:21 -0500 (Sat, 11 Apr 2009)
New Revision: 10518

Modified:
   django/branches/releases/1.0.X/django/db/backends/mysql/client.py
   django/branches/releases/1.0.X/django/db/backends/oracle/client.py
   django/branches/releases/1.0.X/django/db/backends/postgresql/client.py
   django/branches/releases/1.0.X/django/db/backends/sqlite3/client.py
Log:
[1.0.X] Fixed #10357 -- Fixed the "dbshell" command for Windows users.

Thanks to markshep for the patch.

Backport of r10517 from trunk.

Modified: django/branches/releases/1.0.X/django/db/backends/mysql/client.py
===================================================================
--- django/branches/releases/1.0.X/django/db/backends/mysql/client.py   
2009-04-11 11:41:35 UTC (rev 10517)
+++ django/branches/releases/1.0.X/django/db/backends/mysql/client.py   
2009-04-11 11:50:21 UTC (rev 10518)
@@ -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 @@
         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)

Modified: django/branches/releases/1.0.X/django/db/backends/oracle/client.py
===================================================================
--- django/branches/releases/1.0.X/django/db/backends/oracle/client.py  
2009-04-11 11:41:35 UTC (rev 10517)
+++ django/branches/releases/1.0.X/django/db/backends/oracle/client.py  
2009-04-11 11:50:21 UTC (rev 10518)
@@ -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 @@
         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)

Modified: django/branches/releases/1.0.X/django/db/backends/postgresql/client.py
===================================================================
--- django/branches/releases/1.0.X/django/db/backends/postgresql/client.py      
2009-04-11 11:41:35 UTC (rev 10517)
+++ django/branches/releases/1.0.X/django/db/backends/postgresql/client.py      
2009-04-11 11:50:21 UTC (rev 10518)
@@ -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 @@
         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)

Modified: django/branches/releases/1.0.X/django/db/backends/sqlite3/client.py
===================================================================
--- django/branches/releases/1.0.X/django/db/backends/sqlite3/client.py 
2009-04-11 11:41:35 UTC (rev 10517)
+++ django/branches/releases/1.0.X/django/db/backends/sqlite3/client.py 
2009-04-11 11:50:21 UTC (rev 10518)
@@ -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)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to