Django

Code

Changeset 4085

Show
Ignore:
Timestamp:
11/17/06 13:06:22 (2 years ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Fixed unicode bind param handling. Only 3 tests fail
now...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/django/db/backends/oracle/base.py

    r4084 r4085  
    7575        if params is None: 
    7676            params = [] 
     77        else: 
     78            # cx_Oracle can't handle unicode parameters, so cast to str for now 
     79            for i, param in enumerate(params): 
     80                if type(param) == unicode: 
     81                    try: 
     82                        params[i] = param.encode('utf-8') 
     83                    except UnicodeError: 
     84                        params[i] = str(param) 
    7785        args = [(':arg%d' % i) for i in range(len(params))] 
    7886        query = query % tuple(args) 
  • django/branches/boulder-oracle-sprint/django/db/backends/oracle/creation.py

    r4084 r4085  
    8282    #settings.DATABASE_USER = 'old_user' 
    8383    #settings.DATABASE_PASSWORD = 'old_password' 
    84     settings.DATABASE_USER = 'mboersma' 
    85     settings.DATABASE_PASSWORD = 'password' 
    8684 
    8785    cursor = connection.cursor() 
  • django/branches/boulder-oracle-sprint/django/db/backends/oracle/query.py

    r4081 r4085  
    200200 
    201201            if len(limit_and_offset_clause) > 0: 
    202                 full_query = """SELECT * FROM 
    203                     (SELECT %s 
    204                     %s, 
    205                     ROW_NUMBER() %s AS rn 
    206                     %s 
    207                     ) 
    208                     %s 
    209                     """ % (distinct, select_clause, order_by_clause, " ".join(sql), limit_and_offset_clause) 
     202                fmt = \ 
     203"""SELECT * FROM 
     204  (SELECT %s%s, 
     205          ROW_NUMBER()%s AS rn 
     206   %s) 
     207%s""" 
     208                full_query = fmt % (distinct, select_clause, 
     209                                    order_by_clause, ' '.join(sql).strip(), 
     210                                    limit_and_offset_clause) 
    210211            else: 
    211212                full_query = None