Ticket #10566: 10566.diff
File 10566.diff, 2.9 KB (added by , 16 years ago) |
---|
-
django/db/backends/oracle/base.py
31 31 IntegrityError = Database.IntegrityError 32 32 33 33 34 # Check whether cx_Oracle was compiled with the WITH_UNICODE option. This will 35 # also be True in Python 3.0. 36 if int(Database.version.split('.', 1)[0]) >= 5 and not hasattr(Database, 'UNICODE'): 37 convert_unicode = force_unicode 38 else: 39 convert_unicode = smart_str 40 41 34 42 class DatabaseFeatures(BaseDatabaseFeatures): 35 43 empty_fetchmany_value = () 36 44 needs_datetime_string_cast = False … … 165 173 return "RETURNING %s INTO %%s", (InsertIdVar(),) 166 174 167 175 def savepoint_create_sql(self, sid): 168 return "SAVEPOINT " + self.quote_name(sid)176 return convert_unicode("SAVEPOINT " + self.quote_name(sid)) 169 177 170 178 def savepoint_rollback_sql(self, sid): 171 return "ROLLBACK TO SAVEPOINT " + self.quote_name(sid)179 return convert_unicode("ROLLBACK TO SAVEPOINT " + self.quote_name(sid)) 172 180 173 181 def sql_flush(self, style, tables, sequences): 174 182 # Return a list of 'TRUNCATE x;', 'TRUNCATE y;', … … 298 306 def _cursor(self): 299 307 cursor = None 300 308 if not self._valid_connection(): 301 conn_string = self._connect_string()309 conn_string = convert_unicode(self._connect_string()) 302 310 self.connection = Database.connect(conn_string, **self.settings_dict['DATABASE_OPTIONS']) 303 311 cursor = FormatStylePlaceholderCursor(self.connection) 304 312 # Set oracle date to ansi date format. This only needs to execute … … 348 356 if hasattr(param, 'bind_parameter'): 349 357 self.smart_str = param.bind_parameter(cursor) 350 358 else: 351 self.smart_str = smart_str(param, cursor.charset, strings_only) 359 self.smart_str = convert_unicode(param, cursor.charset, 360 strings_only) 352 361 if hasattr(param, 'input_size'): 353 362 # If parameter has `input_size` attribute, use that. 354 363 self.input_size = param.input_size … … 416 425 # is being passed to SQL*Plus. 417 426 if query.endswith(';') or query.endswith('/'): 418 427 query = query[:-1] 419 query = smart_str(query, self.charset) % tuple(args)428 query = convert_unicode(query % tuple(args), self.charset) 420 429 self._guess_input_sizes([params]) 421 430 try: 422 431 return self.cursor.execute(query, self._param_generator(params)) … … 438 447 # is being passed to SQL*Plus. 439 448 if query.endswith(';') or query.endswith('/'): 440 449 query = query[:-1] 441 query = smart_str(query, self.charset) % tuple(args)450 query = convert_unicode(query % tuple(args), self.charset) 442 451 formatted = [self._format_params(i) for i in params] 443 452 self._guess_input_sizes(formatted) 444 453 try: