diff options
| author | Malcolm Tredinnick | 2009-02-18 15:50:52 +1100 | 
|---|---|---|
| committer | Rob Hudson | 2009-03-21 08:29:43 -0700 | 
| commit | 0bed471bb06e3997d29bdc7dc8dec6a0e0c161a0 (patch) | |
| tree | 7809d86305842258f2646d6c401b86cef2448927 /debug_toolbar/panels/sql.py | |
| parent | 50ec9c1b979abd765e7b0f6d0cfa4e24cff18834 (diff) | |
| download | django-debug-toolbar-0bed471bb06e3997d29bdc7dc8dec6a0e0c161a0.tar.bz2 | |
Tidied up SQL formatting in SQL panel.
Added formatting of "GROUP BY" and "HAVING", which now show up in trunk queries
and could have shown up previously if manually patched into the QuerySet.query
instance.
Also indent joined tables a bit more underneath the "FROM" statement: they are
sub-statements of "FROM".
Signed-off-by: Rob Hudson <rob@cogit8.org>
Diffstat (limited to 'debug_toolbar/panels/sql.py')
| -rw-r--r-- | debug_toolbar/panels/sql.py | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index 1aa42f7..b9800b8 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -75,9 +75,11 @@ def reformat_sql(sql):      sql = sql.replace('SELECT ', 'SELECT\n\t')      sql = sql.replace(' FROM ', '\nFROM\n\t')      sql = sql.replace(' WHERE ', '\nWHERE\n\t') -    sql = sql.replace(' INNER JOIN ', '\nINNER JOIN\n\t') -    sql = sql.replace(' LEFT OUTER JOIN ', '\nLEFT OUTER JOIN\n\t') +    sql = sql.replace(' INNER JOIN', '\n\tINNER JOIN') +    sql = sql.replace(' LEFT OUTER JOIN' , '\n\tLEFT OUTER JOIN')      sql = sql.replace(' ORDER BY ', '\nORDER BY\n\t') +    sql = sql.replace(' HAVING ', '\nHAVING\n\t') +    sql = sql.replace(' GROUP BY ', '\nGROUP BY\n\t')      # Use Pygments to highlight SQL if it's available      try:          from pygments import highlight | 
