mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #12612 -- Corrected handling of parameter formatting in SQLite backend so that executemany raises exceptions when bad parameter counts are provided. Thanks to Niels <niels@pythonheads.nl> for the report, and Gabriel Hurley for the help narrowing down the problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12836 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -66,6 +66,19 @@ class DateQuotingTest(TestCase):
|
||||
classes = models.SchoolClass.objects.filter(last_updated__day=20)
|
||||
self.assertEqual(len(classes), 1)
|
||||
|
||||
class ParameterHandlingTest(TestCase):
|
||||
def test_bad_parameter_count(self):
|
||||
"An executemany call with too many/not enough parameters will raise an exception (Refs #12612)"
|
||||
cursor = connection.cursor()
|
||||
query = ('INSERT INTO %s (%s, %s) VALUES (%%s, %%s)' % (
|
||||
connection.introspection.table_name_converter('backends_square'),
|
||||
connection.ops.quote_name('root'),
|
||||
connection.ops.quote_name('square')
|
||||
))
|
||||
self.assertRaises(Exception, cursor.executemany, query, [(1,2,3),])
|
||||
self.assertRaises(Exception, cursor.executemany, query, [(1,),])
|
||||
|
||||
|
||||
def connection_created_test(sender, **kwargs):
|
||||
print 'connection_created signal'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user