Ticket #13648: all_patches.patch
File all_patches.patch, 2.4 KB (added by , 14 years ago) |
---|
-
django/db/models/sql/query.py
1626 1626 entry_params = [] 1627 1627 pos = entry.find("%s") 1628 1628 while pos != -1: 1629 entry_params.append(param_iter.next()) 1629 # allow %s to be sent to the database, example calling strftime 1630 # from sqlite 1631 if entry.find("%%s", pos-1) != pos-1: 1632 entry_params.append(param_iter.next()) 1630 1633 pos = entry.find("%s", pos + 2) 1631 1634 select_pairs[name] = (entry, entry_params) 1632 1635 # This is order preserving, since self.extra_select is a SortedDict. -
django/db/backends/sqlite3/base.py
207 207 if self.settings_dict['NAME'] != ":memory:": 208 208 BaseDatabaseWrapper.close(self) 209 209 210 FORMAT_QMARK_REGEX = re.compile(r'(? ![^%])%s')210 FORMAT_QMARK_REGEX = re.compile(r'(?<![%])%s') 211 211 212 212 class SQLiteCursorWrapper(Database.Cursor): 213 213 """ -
tests/regressiontests/backends/tests.py
47 47 self.assertEqual(long_str, row[0].read()) 48 48 c.execute('DROP TABLE ltext') 49 49 50 51 class SQLiteCheckTest(unittest.TestCase): 52 53 def setUp(self): 54 # Creates the SchoolClass 55 person = models.Person.objects.create(first_name='Django', 56 last_name='Sprint') 57 58 59 def test_regression_13648(self): 60 """ 61 Test %%s scapping for sqlite3 - see #12268__ and #13648__ 62 63 __: http://code.djangoproject.com/ticket/12268 64 __: http://code.djangoproject.com/ticket/13648 65 66 """ 67 self.assertTrue(len(models.Person.objects.all()), 1) 68 qs = models.Person.objects.extra( 69 select={'extra': "strftime(\"%%s\", '2010-11-13', 'utc')"}, 70 ) 71 p = qs.get() 72 self.assertEquals(int(p.extra), 1289617200) 73 50 74 class DateQuotingTest(TestCase): 51 75 52 76 def test_django_date_trunc(self):