django-devserver icon indicating copy to clipboard operation
django-devserver copied to clipboard

Use Django's last_executed_query to quote SQL

Open acdha opened this issue 13 years ago • 1 comments

Previously string values were not quoted, causing sqlparse to interpret them as code. Any value which matched a SQL keyword would be capitalized and indented, causing garbled display of queries containing text like 'of', 'and', 'key', 'limit', etc.

django.db.backends.BaseDatabaseOperations has a helpful last_executed_query method which expands query placeholders (django-debug-toolbar also uses this) reliably. This commit changes the SQL realtime module to use last_executed_query and to perform the formatting after the actual query executes to match the expected semantics.

Closes #13

acdha avatar Nov 07 '12 21:11 acdha

(Pardon the mess: I would have tied this into #13 but Github's API is returning 500s or 422s for a hub pull-request)

acdha avatar Nov 07 '12 21:11 acdha