mirror of
https://github.com/django/django.git
synced 2025-04-13 03:52:20 +00:00
[1.11.x] Fixed #28498 -- Added support for cx_Oracle 6.
- Fixed implicit Decimal to float conversion when input_size is not specified for Decimal parameters. - Used encoding, nencoding parameters of cx_Oracle.connect() to support unicode in DSN. Thanks Tim Graham for the review.
This commit is contained in:
parent
e6dd785bb7
commit
0d21bdd380
@ -200,9 +200,12 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
settings_dict['PASSWORD'], dsn)
|
||||
|
||||
def get_connection_params(self):
|
||||
conn_params = self.settings_dict['OPTIONS'].copy()
|
||||
if 'use_returning_into' in conn_params:
|
||||
del conn_params['use_returning_into']
|
||||
# Specify encoding to support unicode in DSN.
|
||||
conn_params = {'encoding': 'UTF-8', 'nencoding': 'UTF-8'}
|
||||
user_params = self.settings_dict['OPTIONS'].copy()
|
||||
if 'use_returning_into' in user_params:
|
||||
del user_params['use_returning_into']
|
||||
conn_params.update(user_params)
|
||||
return conn_params
|
||||
|
||||
def get_new_connection(self, conn_params):
|
||||
@ -359,6 +362,8 @@ class OracleParam(object):
|
||||
elif string_size > 4000:
|
||||
# Mark any string param greater than 4000 characters as a CLOB.
|
||||
self.input_size = Database.CLOB
|
||||
elif isinstance(param, decimal.Decimal):
|
||||
self.input_size = Database.NUMBER
|
||||
else:
|
||||
self.input_size = None
|
||||
|
||||
|
@ -12,7 +12,7 @@ Bugfixes
|
||||
* Fixed GEOS version parsing if the version has a commit hash at the end (new
|
||||
in GEOS 3.6.2) (:ticket:`28441`).
|
||||
|
||||
* Fixed test database creation with ``cx_Oracle`` 6 (:ticket:`28498`).
|
||||
* Added compatibility for ``cx_Oracle`` 6 (:ticket:`28498`).
|
||||
|
||||
* Fixed select widget rendering when option values are tuples (:ticket:`28502`).
|
||||
|
||||
|
@ -117,6 +117,14 @@ class OracleTests(unittest.TestCase):
|
||||
connection.ensure_connection()
|
||||
self.assertEqual(connection.connection.encoding, "UTF-8")
|
||||
self.assertEqual(connection.connection.nencoding, "UTF-8")
|
||||
# Client encoding may be changed in OPTIONS.
|
||||
new_connection = connection.copy()
|
||||
new_connection.settings_dict['OPTIONS']['encoding'] = 'ISO-8859-2'
|
||||
new_connection.settings_dict['OPTIONS']['nencoding'] = 'ASCII'
|
||||
new_connection.ensure_connection()
|
||||
self.assertEqual(new_connection.connection.encoding, 'ISO-8859-2')
|
||||
self.assertEqual(new_connection.connection.nencoding, 'ASCII')
|
||||
new_connection.close()
|
||||
|
||||
def test_order_of_nls_parameters(self):
|
||||
# an 'almost right' datetime should work with configured
|
||||
|
Loading…
x
Reference in New Issue
Block a user