Ticket #13648: sqlite_base_with_test.diff

File sqlite_base_with_test.diff, 1.4 KB (added by Guilherme Salgado, 14 years ago)

a fix for just this issue; based on the fix from #15155

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

    diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
    index 8344bad..2de2818 100644
    a b class DatabaseWrapper(BaseDatabaseWrapper):  
    220220        if self.settings_dict['NAME'] != ":memory:":
    221221            BaseDatabaseWrapper.close(self)
    222222
    223 FORMAT_QMARK_REGEX = re.compile(r'(?![^%])%s')
     223FORMAT_QMARK_REGEX = re.compile(r'(?<!%)%s')
    224224
    225225class SQLiteCursorWrapper(Database.Cursor):
    226226    """
  • tests/regressiontests/backends/tests.py

    diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py
    index efa3e0c..f94f5c1 100644
    a b class ConnectionCreatedSignalTest(TestCase):  
    194194        self.assertTrue(data == {})
    195195
    196196
     197class EscapingChecks(TestCase):
     198
     199    @unittest.skipUnless(connection.vendor == 'sqlite',
     200                         "This is a sqlite-specific issue")
     201    def test_parameter_escaping(self):
     202        #13648: '%s' escaping support for sqlite3
     203        cursor = connection.cursor()
     204        response = cursor.execute(
     205            "select strftime('%%s', date('now'))").fetchall()[0][0]
     206        self.assertNotEqual(response, None)
     207
     208
    197209class BackendTestCase(TestCase):
    198210    def test_cursor_executemany(self):
    199211        #4896: Test cursor.executemany
Back to Top