#29610: Crash in sqlite3 last_executed_query when using printf() formatting
-------------------------------------+-------------------------------------
     Reporter:  Matthias Kestenholz  |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales):

 * type:  Bug => Uncategorized


Comment:

 If you want the raw SQL ``"%x"`` formatting specifier to reach the sqlite
 `printf` function you'll need to double the `%` so it gets passed "un-
 interpreted" by the query building stage.

 We have documentation about this requirement in other areas all of them
 related to raw SQL handling (circumventing the ORM):

 * https://docs.djangoproject.com/en/2.0/topics/db/sql/#executing-custom-
 sql-directly
 * https://docs.djangoproject.com/en/2.0/releases/1.6/#percent-literals-in-
 cursor-execute-queries
 * https://docs.djangoproject.com/en/2.0/releases/1.7.1/#bugfixes (serarch
 for 'percent')
 * https://docs.djangoproject.com/en/2.0/ref/migration-operations/#runsql

 It could argued a similar note should be added to the
 ``connection.cursor.db.ops.last_executed_query()`` docs but currently it
 isn't documented, which IMHO isn't strange as it isn't a public API at
 all.

 Do we want it to be a public API? The answer to this question would decide
 if this ticket should be converted to a documentation issue or closed as
 wontfix.

 Or we could accept a patch for the ``last_executed_query()`` docstring.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29610#comment:1>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.86c41f7dc0d1f20207d8e56c679b1ca6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to