Ticket #15155: fix-15155.patch

File fix-15155.patch, 1.4 KB (added by zyga, 14 years ago)

Patch + test case

  • django/db/backends/sqlite3/base.py

     
    186186        if self.settings_dict['NAME'] != ":memory:":
    187187            BaseDatabaseWrapper.close(self)
    188188
    189 FORMAT_QMARK_REGEX = re.compile(r'(?![^%])%s')
     189FORMAT_QMARK_REGEX = re.compile(r'(?<!%)%s')
    190190
    191191class SQLiteCursorWrapper(Database.Cursor):
    192192    """
  • tests/regressiontests/backends/tests.py

     
    206206        self.assertEqual(cursor.fetchone(), (u'Clark', u'Kent'))
    207207        self.assertEqual(list(cursor.fetchmany(2)), [(u'Jane', u'Doe'), (u'John', u'Doe')])
    208208        self.assertEqual(list(cursor.fetchall()), [(u'Mary', u'Agnelline'), (u'Peter', u'Parker')])
     209
     210if settings.DATABASES[DEFAULT_DB_ALIAS]["ENGINE"] == "django.db.backends.sqlite3":
     211    class EscapingChecks(unittest.TestCase):
     212
     213        def test_parameter_escaping(self):
     214            # ticket #15155
     215            cursor = connection.cursor()
     216            response = cursor.execute("select strftime('%%s', date('now'))").fetchall()[0][0]
     217            self.assertNotEqual(response, None)
Back to Top