$Database = Gdn::database(); $SQL = $Database->sql(); if (!is_null($Database)) { $String = ''; $Queries = $Database->Queries(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] . ' <small>' . $QueryInfo['connection'] . '</small>' . ' <small>' . @number_format($QueryInfo['Time'], 6) . 's</small> ' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], true) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>'; } echo $String; } global $Start; echo '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; ?> <h3>Controller Data</h3> <pre> <?php echo DebuggerPlugin::FormatData(Gdn::controller()->Data); ?> </pre> </div>