From e9271bf69ab50cb24e38ac2205847c8d32b83ca8 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Mon, 6 Oct 2008 13:07:56 -0700 Subject: Just like EXPLAIN, adding the output of straight SELECT statements so you can view the raw SQL output. --- debug_toolbar/views.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'debug_toolbar/views.py') diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py index b67a70b..4b666e1 100644 --- a/debug_toolbar/views.py +++ b/debug_toolbar/views.py @@ -20,6 +20,37 @@ def debug_media(request, path): root = os.path.join(parent, 'media') return django.views.static.serve(request, path, root) +def sql_select(request): + """ + Returns the output of the SQL SELECT statement. + + Expected GET variables: + sql: urlencoded sql with positional arguments + params: JSON encoded parameter values + time: time for SQL to execute passed in from toolbar just for redisplay + hash: the hash of (secret + sql + params) for tamper checking + """ + from debug_toolbar.panels.sql import reformat_sql + sql = request.GET.get('sql', '') + params = request.GET.get('params', '') + hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() + if hash != request.GET.get('hash', ''): + return HttpResponse('