Esempio n. 1
0
 static function main()
 {
     $user_method = null;
     $params = null;
     $route = null;
     $user_class = null;
     $base = system_base_Wet_base::get_instance();
     $cache = system_base_Cache::get_instance();
     $profiler = system_base_Profiler::get_instance();
     $cl = null;
     try {
         if (system_base_Router::$instance === null) {
             system_base_Router::$instance = new system_base_Router();
         }
         $route = system_base_Router::$instance;
         if (!$route->decode_route()) {
             if ($route->controller === "_load") {
                 system_base_Cache::load_asset($route->method);
             }
             return;
         }
         if (Index_0($base, $cache, $cl, $params, $profiler, $route, $user_class, $user_method)) {
             return;
         }
         $cl = Type::resolveClass("system.application.controllers." . _hx_string_or_null($route->controller));
         if ($cl === null) {
             throw new HException(new system_base_Http_exception(_hx_string_or_null($route->controller) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 81, "className" => "Index", "methodName" => "main"))));
         } else {
             $user_class = Type::createInstance($cl, new _hx_array(array()));
             $user_method = Reflect::field($user_class, $route->method);
             if ($user_method === null) {
                 throw new HException(new system_base_Http_exception(_hx_string_or_null($route->method) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 89, "className" => "Index", "methodName" => "main"))));
             } else {
                 $user_class->set_params($route->params);
                 Reflect::callMethod($user_class, $user_method, new _hx_array(array()));
                 Reflect::callMethod($user_class, Reflect::field($user_class, "flush"), new _hx_array(array()));
             }
         }
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         if (($e = $_ex_) instanceof system_base_Error) {
         } else {
             throw $__hx__e;
         }
     }
     system_base_Database::close();
 }
Esempio n. 2
0
 static function stop()
 {
     system_base_Profiler::$stop_time = haxe_Timer::stamp();
     system_base_Profiler::$run_time = system_base_Profiler::$stop_time - system_base_Profiler::$start_time;
     return system_base_Profiler::$run_time;
 }
Esempio n. 3
0
 static function run_query($usr_sql)
 {
     $profiler = system_base_Profiler::get_instance();
     $verb = null;
     $results = null;
     $results = null;
     if (system_base_Database::$cnx === null) {
         throw new HException(new system_base_Dbexception());
     }
     $timer = new system_base_Timers(null);
     try {
         $results = system_base_Database::$cnx->request($usr_sql);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         if (is_string($e = $_ex_)) {
             throw new HException(new system_base_BadSQLException($e, $usr_sql));
         } else {
             throw $__hx__e;
         }
     }
     $stopped = $timer->stop();
     if (system_base_Database::$regexp->match($usr_sql)) {
         $verb = strtoupper(_hx_substr($usr_sql, 0, 3));
         $profiler->increment($verb, $stopped, $usr_sql);
     } else {
         $profiler->increment("OTH", $stopped, $usr_sql);
     }
     $profiler->increment("QUE", $stopped, null);
     return $results;
 }
Esempio n. 4
0
 static function explain_all()
 {
     $profiler = system_base_Profiler::get_instance();
     $db = system_base_Database::get_instance(null, null, null, null, null, null, null, null);
     if (strlen($profiler->get("SEL")->slow_sql) > 1) {
         system_base_Cache::$profile_buffer->append("<div class=\"__webrathea_debug__\">Webrathea Engine Slow Query Analysys</div>");
         system_base_Cache::$profile_buffer->append($db->explain($profiler->get("SEL")->slow_sql, false));
     }
 }