diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 23bfafbba4..23df66a762 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -11,6 +11,7 @@ class BaseDatabaseWrapper(local): Represents a database connection. """ ops = None + vendor = 'unknown' def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS): # `settings_dict` should be a dictionary containing keys such as @@ -20,7 +21,6 @@ class BaseDatabaseWrapper(local): self.queries = [] self.settings_dict = settings_dict self.alias = alias - self.vendor = 'unknown' self.use_debug_cursor = None def __eq__(self, other): diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py index e457629880..efa3e0c7d3 100644 --- a/tests/regressiontests/backends/tests.py +++ b/tests/regressiontests/backends/tests.py @@ -47,6 +47,15 @@ class OracleChecks(unittest.TestCase): self.assertEqual(long_str, row[0].read()) c.execute('DROP TABLE ltext') + @unittest.skipUnless(connection.vendor == 'oracle', + "No need to check Oracle connection semantics") + def test_client_encoding(self): + # If the backend is Oracle, test that the client encoding is set + # correctly. This was broken under Cygwin prior to r14781. + c = connection.cursor() # Ensure the connection is initialized. + self.assertEqual(connection.connection.encoding, "UTF-8") + self.assertEqual(connection.connection.nencoding, "UTF-8") + class DateQuotingTest(TestCase): def test_django_date_trunc(self):