#9055: Percent sign in SQL statement behaves different with CursorDebugWrapper
-------------------------------------+-------------------------------------
     Reporter:  guettli              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.0
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by hlhicks@…):

 I'm not sure how this ticket got sidetracked into parameters in execute.
 that may be an issue as well, but the original problem mentioned above
 refers to "if the string contains a percent sign."  If the query has a
 percent sign, then self.db.ops.last_executed_query(...) will bomb when it
 tries to do a string substitution.  It will also fail if the query has a
 different parameter sub method (like ?) .  For example...
 cursor.execute("insert into the_table (name, phone, zip) values
 (?,?,?)",("me","800...","30101"))  will throw an exception because it
 cannot substitute the three parameters into the query.

 last_executed_query needs to use the backends substitution method (which
 may be complicated to do).  Or else just store the parameters as a repr
 after the query string.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/9055#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to