本文整理汇总了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));
}
示例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());
}
}
示例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;
}
示例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);
}
示例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';
}
示例6: get_query_log
public function get_query_log()
{
return \ORM::get_query_log($this->connectionName);
}
示例7: getQueryLog
public function getQueryLog()
{
return \ORM::get_query_log();
}
示例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());
}