diff options
author | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2006-11-17 19:06:22 +0000 |
---|---|---|
committer | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2006-11-17 19:06:22 +0000 |
commit | 174463e62c732b33842e454f9763c5b066fc5af4 (patch) | |
tree | c352188f67eb35780b4e3c72c80b2d066550016f /django/db | |
parent | 677aa10cdf376286f694edb2263d269dbd3269c5 (diff) | |
download | django-174463e62c732b33842e454f9763c5b066fc5af4.tar.gz |
boulder-oracle-sprint: Fixed unicode bind param handling. Only 3 tests fail
now...
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4085 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
-rw-r--r-- | django/db/backends/oracle/base.py | 8 | ||||
-rw-r--r-- | django/db/backends/oracle/creation.py | 2 | ||||
-rw-r--r-- | django/db/backends/oracle/query.py | 17 |
3 files changed, 17 insertions, 10 deletions
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index d277e5b6f7..4096d0e1e6 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -74,6 +74,14 @@ class FormatStylePlaceholderCursor(Database.Cursor): def _rewrite_args(self, query, params=None): if params is None: params = [] + else: + # cx_Oracle can't handle unicode parameters, so cast to str for now + for i, param in enumerate(params): + if type(param) == unicode: + try: + params[i] = param.encode('utf-8') + except UnicodeError: + params[i] = str(param) args = [(':arg%d' % i) for i in range(len(params))] query = query % tuple(args) # cx_Oracle cannot execute a query with the closing ';' diff --git a/django/db/backends/oracle/creation.py b/django/db/backends/oracle/creation.py index c3326cf843..c1387a7ff8 100644 --- a/django/db/backends/oracle/creation.py +++ b/django/db/backends/oracle/creation.py @@ -81,8 +81,6 @@ def destroy_test_db(settings, connection, backend, old_database_name, verbosity= settings.DATABASE_NAME = old_database_name #settings.DATABASE_USER = 'old_user' #settings.DATABASE_PASSWORD = 'old_password' - settings.DATABASE_USER = 'mboersma' - settings.DATABASE_PASSWORD = 'password' cursor = connection.cursor() time.sleep(1) # To avoid "database is being accessed by other users" errors. diff --git a/django/db/backends/oracle/query.py b/django/db/backends/oracle/query.py index 46f303f8db..bcd29f9acc 100644 --- a/django/db/backends/oracle/query.py +++ b/django/db/backends/oracle/query.py @@ -199,14 +199,15 @@ def get_query_set_class(DefaultQuerySet): limit_and_offset_clause = "WHERE rn > %s" % (offset) if len(limit_and_offset_clause) > 0: - full_query = """SELECT * FROM - (SELECT %s - %s, - ROW_NUMBER() %s AS rn - %s - ) - %s - """ % (distinct, select_clause, order_by_clause, " ".join(sql), limit_and_offset_clause) + fmt = \ +"""SELECT * FROM + (SELECT %s%s, + ROW_NUMBER()%s AS rn + %s) +%s""" + full_query = fmt % (distinct, select_clause, + order_by_clause, ' '.join(sql).strip(), + limit_and_offset_clause) else: full_query = None |