diff options
| author | Shai Berger <shai.berger@healarium.com> | 2013-05-16 15:01:39 +0300 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-05-16 15:00:16 +0200 |
| commit | 9ef4d177d1d501be44b6e1c87197fef1e26900f1 (patch) | |
| tree | 6bc5c59a93ec8b6a85b2567fa22fcddf78f8dfcd | |
| parent | 79715f267c7b301dc246b35182ede3e269a15aa2 (diff) | |
Fixed #20388 -- Test failures under Oracle.
Add "FROM DUAL" to SQL selecting constants in tests for Oracle.
| -rw-r--r-- | tests/backends/tests.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py index a426926cef..81b2851403 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -367,14 +367,19 @@ class EscapingChecks(TestCase): All tests in this test case are also run with settings.DEBUG=True in EscapingChecksDebug test case, to also test CursorDebugWrapper. """ + + # For Oracle, when you want to select a value, you need to specify the + # special pseudo-table 'dual'; a select with no from clause is invalid. + bare_select_suffix = " FROM DUAL" if connection.vendor == 'oracle' else "" + def test_paramless_no_escaping(self): cursor = connection.cursor() - cursor.execute("SELECT '%s'") + cursor.execute("SELECT '%s'" + self.bare_select_suffix) self.assertEqual(cursor.fetchall()[0][0], '%s') def test_parameter_escaping(self): cursor = connection.cursor() - cursor.execute("SELECT '%%', %s", ('%d',)) + cursor.execute("SELECT '%%', %s" + self.bare_select_suffix, ('%d',)) self.assertEqual(cursor.fetchall()[0], ('%', '%d')) @unittest.skipUnless(connection.vendor == 'sqlite', |
