Example #1
0
/**
 * Mostra tabela com todos os SQLs rodados
 *
 * @param array $sql Códigos SQL já rodados
 */
function debugSQLs($sql)
{
    if (is_array($sql)) {
        $sqlCommands = array("SELECT", "UPDATE", "DELETE", "INSERT", "REPLACE", "FROM", "ASC", "WHERE", "ORDER BY", "LIMIT", "TABLES", "LEFT JOIN", "DISTINCT", "COUNT", "ON", "DESCRIBE", "SHOW", "INTO", "VALUES", "SET", "IN", "NOT IN", "OR", "AND", "AS", "DESC");
        $boldSqlCommands = array();
        foreach ($sqlCommands as $valor) {
            $boldSqlCommands[] = "<strong>" . $valor . "</strong>";
        }
        echo '<table width="100%" style="background: white; padding: 10px;">';
        echo '<tr>';
        echo '<td style="font-size: 12px;">';
        echo "<strong>Instruções SQL</strong>";
        echo '</td>';
        echo '<td style="font-size: 12px;">';
        echo "<strong>Tempo</strong>";
        echo '</td>';
        echo '</tr>';
        foreach ($sql as $chave => $valor) {
            echo '<tr>';
            echo '<td style="font-size: 12px;">';
            if (Config::read("debugSQLStyle")) {
                $sql = $valor["sql"];
                $sql = str_replace($sqlCommands, $boldSqlCommands, $sql);
                echo $sql;
            } else {
                echo $valor["sql"];
            }
            echo '</td>';
            echo '<td style="font-size: 12px;">';
            echo showLoadingTime($valor["time"]);
            echo '</td>';
            echo '</tr>';
            echo '<tr><td colspan="2" style="font-size: 0; background: silver;"></td></tr>';
        }
        echo '</table>';
    }
}
Example #2
0
 */
//if( is_file(APP_CONTROLLER_DIR.$engine->callController."_controller.php") ){
include APP_CONTROLLER_DIR . $engine->callController . "_controller.php";
//}
/**
 * MVC
 */
/**
 * Prepara parâmetros de carregamentos de controllers
 */
$callControllerClass = $engine->callControllerClass . "Controller";
$param = array("engine" => $engine);
/**
 * Carrega o sistema de controller
 */
$appRunningController = new $callControllerClass($param);
/**
 * AMOSTRAGEM DE DEBUG
 */
/**
 * TIMER END
 */
$endTime = microtime(true);
showLoadingTime($endTime - $startTime);
/**
 * Mostra debug SQL
 */
if (Config::read("debug") >= 1) {
    debugSQLs(Config::read("SQLs"));
}
//echo $endTime-$startTime;