diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-04-05 14:15:30 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-04-05 14:18:34 +0200 |
| commit | 975c5afdb5a0c2f9f61f9faecf8dbd928c4996b7 (patch) | |
| tree | 84c37b958c88dde06875e9ee3258433a1af0454a /docs | |
| parent | 23229061fcb836ecca2195cc75f91e331279a5d1 (diff) | |
Added release note about percent literals in cursor.execute
Thanks Aymeric Augustin for noticing the omission and Tim Graham
for the text review.
Fixes #9055 (again).
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.6.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt index 3258798c13..2f06756a1b 100644 --- a/docs/releases/1.6.txt +++ b/docs/releases/1.6.txt @@ -392,6 +392,24 @@ If you do not apply this change, the behaviour is unchanged: on MySQL, IPv6 addresses are silently truncated; on Oracle, an exception is generated. No database change is needed for SQLite or PostgreSQL databases. +Percent literals in ``cursor.execute`` queries +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When you are running raw SQL queries through the +:ref:`cursor.execute <executing-custom-sql>` method, the rule about doubling +percent literals (``%``) inside the query has been unified. Past behavior +depended on the database backend. Now, across all backends, you only need to +double literal percent characters if you are also providing replacement +parameters. For example:: + + # No parameters, no percent doubling + cursor.execute("SELECT foo FROM bar WHERE baz = '30%'") + + # Parameters passed, non-placeholders have to be doubled + cursor.execute("SELECT foo FROM bar WHERE baz = '30%%' and id = %s", [self.id]) + +``SQLite`` users need to check and update such queries. + Miscellaneous ~~~~~~~~~~~~~ |
