Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Django's last_executed_query to quote SQL #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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