Ticket #10357: db.patch

File db.patch, 3.4 KB (added by markshep, 16 years ago)
  • db/backends/mysql/client.py

    diff -ru django-1.0.2-final/db/backends/mysql/client.py django/db/backends/mysql/client.py
    old new  
    11from django.db.backends import BaseDatabaseClient
    22from django.conf import settings
    33import os
     4import sys
    45
    56class DatabaseClient(BaseDatabaseClient):
    67    executable_name = 'mysql'
    78
    89    def runshell(self):
    9         args = ['']
     10        args = [self.executable_name]
    1011        db = settings.DATABASE_OPTIONS.get('db', settings.DATABASE_NAME)
    1112        user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
    1213        passwd = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
     
    2829        if db:
    2930            args += [db]
    3031
    31         os.execvp(self.executable_name, args)
     32        if os.name == 'nt':
     33            sys.exit(os.system(" ".join(args)))
     34        else:
     35            os.execvp(self.executable_name, args)
  • db/backends/oracle/client.py

    diff -ru django-1.0.2-final/db/backends/oracle/client.py django/db/backends/oracle/client.py
    old new  
    11from django.db.backends import BaseDatabaseClient
    22from django.conf import settings
    33import os
     4import sys
    45
    56class DatabaseClient(BaseDatabaseClient):
    67    executable_name = 'sqlplus'
     
    1213        if settings.DATABASE_NAME:
    1314            dsn += "@%s" % settings.DATABASE_NAME
    1415        args = [self.executable_name, "-L", dsn]
    15         os.execvp(self.executable_name, args)
     16        if os.name == 'nt':
     17            sys.exit(os.system(" ".join(args)))
     18        else:
     19            os.execvp(self.executable_name, args)
  • db/backends/postgresql/client.py

    diff -ru django-1.0.2-final/db/backends/postgresql/client.py django/db/backends/postgresql/client.py
    old new  
    11from django.db.backends import BaseDatabaseClient
    22from django.conf import settings
    33import os
     4import sys
    45
    56class DatabaseClient(BaseDatabaseClient):
    67    executable_name = 'psql'
     
    1617        if settings.DATABASE_PORT:
    1718            args.extend(["-p", str(settings.DATABASE_PORT)])
    1819        args += [settings.DATABASE_NAME]
    19         os.execvp(self.executable_name, args)
     20        if os.name == 'nt':
     21            sys.exit(os.system(" ".join(args)))
     22        else:
     23            os.execvp(self.executable_name, args)
  • db/backends/sqlite3/client.py

    diff -ru django-1.0.2-final/db/backends/sqlite3/client.py django/db/backends/sqlite3/client.py
    old new  
    11from django.db.backends import BaseDatabaseClient
    22from django.conf import settings
    33import os
     4import sys
    45
    56class DatabaseClient(BaseDatabaseClient):
    67    executable_name = 'sqlite3'
    78
    89    def runshell(self):
    9         args = ['', settings.DATABASE_NAME]
    10         os.execvp(self.executable_name, args)
     10        args = [self.executable_name, settings.DATABASE_NAME]
     11        if os.name == 'nt':
     12            sys.exit(os.system(" ".join(args)))
     13        else:
     14            os.execvp(self.executable_name, args)
Back to Top