16e48f39ce72d6b09a3854ec878c5b69e1529daa

Author: ichikaway

Date: 2009-07-07 13:16:50 +0900

SQL syntax highlight in SQL log panel : using GeSHi

diff --git a/views/elements/sql_log_panel.ctp b/views/elements/sql_log_panel.ctp index 3771829..7aea147 100644 --- a/views/elements/sql_log_panel.ctp +++ b/views/elements/sql_log_panel.ctp @@ -19,11 +19,23 @@ **/ ?> <h2><?php __d('debug_kit', 'Sql Logs')?></h2> + +<?php $geshi_import = App::import('Vendor', 'DebugKit.geshi.geshi') ; ?> + <?php if (!empty($content)) : ?> <?php foreach ($content as $dbName => $queryLog) : ?> <div class="sql-log-panel-query-log"> <h4><?php echo $dbName ?></h4> <?php + + if($geshi_import && !empty($queryLog['queries']) ){ + foreach( $queryLog['queries'] as $key => $query_val ){ + $geshi = new GeSHi($query_val[1], 'SQL'); + $queryLog['queries'][$key][1] = $geshi->parse_code(); + } + } + + $headers = array('Nr', 'Query', 'Error', 'Affected', 'Num. rows', 'Took (ms)'); echo $toolbar->table($queryLog['queries'], $headers, array('title' => 'SQL Log ' . $dbName));