Skip to content

Conversation

acdha
Copy link
Contributor

@acdha acdha commented Nov 7, 2012

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

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 dcramer#13
@acdha
Copy link
Contributor Author

acdha commented Nov 7, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql logger should quote query params

1 participant