当前位置: 首页>>代码示例>>PHP>>正文


PHP ORM::get_query_log方法代码示例

本文整理汇总了PHP中ORM::get_query_log方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::get_query_log方法的具体用法?PHP ORM::get_query_log怎么用?PHP ORM::get_query_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ORM的用法示例。


在下文中一共展示了ORM::get_query_log方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call

 function call()
 {
     $app = $this->app;
     $res = $app->response();
     try {
         $this->next->call();
         if (self::$disabled) {
             return;
         }
         if ($res->status() !== 200) {
             return;
         }
         $res['Content-Type'] = 'application/json';
         $result = self::prepForEncoding(self::$result);
         $res->status(200);
     } catch (Exception $e) {
         if ($e instanceof PDOException) {
             $log = $app->getLog();
             foreach (ORM::get_query_log() as $entry) {
                 $log->debug($entry);
             }
         }
         $res['Content-Type'] = 'application/json';
         $result = array('error' => $e->getMessage());
         $log = $app->getLog();
         $log->debug($e->getMessage() . "\n" . $e->getTraceAsString());
         if ($e instanceof AccessException) {
             $res->status($e->getCode());
         } else {
             $res->status(500);
         }
     }
     // encode
     $res->write(defined('JSON_PRETTY_PRINT') ? json_encode($result, JSON_PRETTY_PRINT & JSON_NUMERIC_CHECK) : json_encode($result, JSON_NUMERIC_CHECK));
 }
开发者ID:2bj,项目名称:slim-common,代码行数:35,代码来源:api.php

示例2: getDebugInfo

 public static function getDebugInfo()
 {
     $enabled = self::$enabled && session_getUserNick() == pref_getDebugUser();
     smarty_assign('debug_enabled', $enabled);
     if ($enabled) {
         smarty_assign('debug_messages', self::$debugInfo);
         smarty_assign('debug_runningTimeMillis', self::getRunningTimeInMillis());
         smarty_assign('debug_ormQueryLog', ORM::get_query_log());
     }
 }
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:10,代码来源:DebugInfo.php

示例3: show

 public static function show($file)
 {
     // View paramater is deprecated and should not be used
     $view = Base::$g + self::$tpl;
     $view['content'] = self::$mst->render($file, $view);
     echo self::$mst->render('wrapper', $view);
     if (DEBUG) {
         $debug = array_count_values(ORM::get_query_log());
         $debug = print_r($debug, 1);
         $debug = str_replace("\n", '<br>', $debug);
         echo $debug;
     }
     exit;
 }
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:14,代码来源:View.php

示例4: testChainedRelationships

 public function testChainedRelationships()
 {
     $owner = Owner::with(array('car' => array('with' => 'manufactor')))->find_one(1);
     $fullQueryLog = ORM::get_query_log();
     // Return last three queries
     $actualSql = array_slice($fullQueryLog, count($fullQueryLog) - 3);
     $expectedSql = array();
     $expectedSql[] = "SELECT * FROM `owner` WHERE `id` = '1' LIMIT 1";
     $expectedSql[] = "SELECT * FROM `car` WHERE `owner_id` IN ('1')";
     $expectedSql[] = "SELECT * FROM `manufactor` WHERE `id` IN ('1')";
     $this->assertEquals($expectedSql, $actualSql);
 }
开发者ID:arunkapil,项目名称:Granada,代码行数:12,代码来源:EagerTest.php

示例5: substr

        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, strtolower($className)) . '.php';
    // error_log($fileName);
    if (file_exists($fileName)) {
        return require $fileName;
    }
});
// Initialize Slim:
$app = new \Slim\Slim(array('templates.path' => ROOT . '/templates', 'log.enabled' => true));
// Load config management library:
require ROOT . '/common/config.php';
// Set logging level:
$log = $app->getLog();
$log->setLevel(config('log.level', 0));
// Load default libraries:
require ROOT . '/common/memcached.php';
require ROOT . '/common/db.php';
require ROOT . '/common/session.php';
// Setup the slim.after hook for printing DB log
$app->hook('slim.after', function () use($app) {
    foreach (ORM::get_query_log() as $entry) {
        $app->getLog()->debug($entry);
    }
});
// Add API functionality
if (config('use.api', false)) {
    require ROOT . '/common/api.php';
}
开发者ID:2bj,项目名称:slim-common,代码行数:31,代码来源:bootstrap.php

示例6: get_query_log

 public function get_query_log()
 {
     return \ORM::get_query_log($this->connectionName);
 }
开发者ID:arseniew,项目名称:silex-idiorm-provider,代码行数:4,代码来源:IdiormService.php

示例7: getQueryLog

 public function getQueryLog()
 {
     return \ORM::get_query_log();
 }
开发者ID:ingeting,项目名称:silex-service-providers,代码行数:4,代码来源:ParisProvider.php

示例8: getDebugInfo

 public static function getDebugInfo()
 {
     $enabled = self::$enabled && session_getUserNick() == Config::get('global.debugUser');
     return array('enabled' => $enabled, 'messages' => self::$debugInfo, 'runningTimeMillis' => self::getRunningTimeInMillis(), 'ormQueryLog' => ORM::get_query_log());
 }
开发者ID:florinp,项目名称:dexonline,代码行数:5,代码来源:DebugInfo.php


注:本文中的ORM::get_query_log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。