summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/client.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-08-11 12:11:25 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-08-11 12:11:25 +0000
commit9dc4ba875f21d5690f6ad5995123a67a3c44bafe (patch)
tree621f876758ac16dceee95faf51973d4b05f1c830 /django/db/backends/mysql/client.py
parentcec69eb70d1e2f84dc5a7fb172da88a79b0f5063 (diff)
downloaddjango-9dc4ba875f21d5690f6ad5995123a67a3c44bafe.tar.gz
Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/mysql/client.py')
-rw-r--r--django/db/backends/mysql/client.py46
1 files changed, 24 insertions, 22 deletions
diff --git a/django/db/backends/mysql/client.py b/django/db/backends/mysql/client.py
index 116074a9ce..24758867af 100644
--- a/django/db/backends/mysql/client.py
+++ b/django/db/backends/mysql/client.py
@@ -1,27 +1,29 @@
+from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
-def runshell():
- args = ['']
- 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)
- host = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST)
- port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT)
- defaults_file = settings.DATABASE_OPTIONS.get('read_default_file')
- # Seems to be no good way to set sql_mode with CLI
+class DatabaseClient(BaseDatabaseClient):
+ def runshell(self):
+ args = ['']
+ 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)
+ host = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST)
+ port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT)
+ defaults_file = settings.DATABASE_OPTIONS.get('read_default_file')
+ # Seems to be no good way to set sql_mode with CLI
- if defaults_file:
- args += ["--defaults-file=%s" % defaults_file]
- if user:
- args += ["--user=%s" % user]
- if passwd:
- args += ["--password=%s" % passwd]
- if host:
- args += ["--host=%s" % host]
- if port:
- args += ["--port=%s" % port]
- if db:
- args += [db]
+ if defaults_file:
+ args += ["--defaults-file=%s" % defaults_file]
+ if user:
+ args += ["--user=%s" % user]
+ if passwd:
+ args += ["--password=%s" % passwd]
+ if host:
+ args += ["--host=%s" % host]
+ if port:
+ args += ["--port=%s" % port]
+ if db:
+ args += [db]
- os.execvp('mysql', args)
+ os.execvp('mysql', args)