summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Manfre <mmanfre@gmail.com>2014-01-08 23:31:34 -0500
committerMichael Manfre <mmanfre@gmail.com>2014-02-02 12:47:06 -0500
commit0837eacc4e1fa7916e48135e8ba43f54a7a64997 (patch)
treeacd1f5961d3bbf1a59f9b3ca515712dad4c8e52a /tests
parentab2f21080d8b3112c1ba9a0bf923eae733be4242 (diff)
Made SQLCompiler.execute_sql(result_type) more explicit.
Updated SQLUpdateCompiler.execute_sql to match the behavior described in the docstring; the 'first non-empty query' will now include all queries, not just the main and first related update. Added CURSOR and NO_RESULTS result_type constants to make the usages more self documenting and allow execute_sql to explicitly close the cursor when it is no longer needed.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/tests.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 0ff3ad0bba..4a3fc31b7a 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -20,6 +20,7 @@ from django.db.backends.utils import format_number, CursorWrapper
from django.db.models import Sum, Avg, Variance, StdDev
from django.db.models.fields import (AutoField, DateField, DateTimeField,
DecimalField, IntegerField, TimeField)
+from django.db.models.sql.constants import CURSOR
from django.db.utils import ConnectionHandler
from django.test import (TestCase, TransactionTestCase, override_settings,
skipUnlessDBFeature, skipIfDBFeature)
@@ -209,7 +210,7 @@ class LastExecutedQueryTest(TestCase):
"""
persons = models.Reporter.objects.filter(raw_data=b'\x00\x46 \xFE').extra(select={'föö': 1})
sql, params = persons.query.sql_with_params()
- cursor = persons.query.get_compiler('default').execute_sql(None)
+ cursor = persons.query.get_compiler('default').execute_sql(CURSOR)
last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)
self.assertIsInstance(last_sql, six.text_type)