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


PHP DB::getQueryLog方法代码示例

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


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

示例1: getCities

 static function getCities($regionId, $countryId = "IN")
 {
     $cities = Cities::where('country', '=', $countryId)->where('region', '=', $regionId)->lists('name', 'ID');
     $queries = DB::getQueryLog();
     /* print_R($queries);
     		
     		dd($cities); */
     return $cities;
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:9,代码来源:Cities.php

示例2: GetAllPost

 /**
  * 返回所有文章
  */
 function GetAllPost(Request $request)
 {
     DB::connection()->enableQueryLog();
     $postSrv = new Post();
     $res = $postSrv->GetAllPost($request->all());
     $res['success'] = $res['data'] ? true : false;
     $res['sql'] = DB::getQueryLog();
     return json_encode($res, JSON_UNESCAPED_UNICODE);
 }
开发者ID:kubill,项目名称:lumen,代码行数:12,代码来源:AdminController.php

示例3:

 /**
  * @param CachingRepositoryInterface $repository
  */
 function check_caching_repository_caching(CachingRepositoryInterface $repository)
 {
     DB::enableQueryLog();
     $this->assertCount(8, $repository->inProgress()->get());
     $this->assertCount(10, $repository->completed()->get());
     $this->assertCount(2, DB::getQueryLog());
     $this->assertCount(8, $repository->inProgress()->get());
     $this->assertCount(10, $repository->completed()->get());
     $this->assertCount(2, DB::getQueryLog());
     $this->assertCount(18, $repository->all());
     $this->assertCount(3, DB::getQueryLog());
     $this->assertCount(18, $repository->all());
     $this->assertCount(3, DB::getQueryLog());
     DB::disableQueryLog();
     \Cache::flush();
 }
开发者ID:logaretm,项目名称:depo,代码行数:19,代码来源:CachingRepositoryTest.php

示例4: buildTree

 private function buildTree($parent_id, &$container, $level, $max_level, $include_children_count, $include_products_count)
 {
     if ($level > $max_level) {
         return;
     }
     $select = array('c.id', 'c.parent_id', 'cd.name');
     $query = $this->buildQuery($include_children_count, $include_products_count);
     $query->where('c.parent_id', $parent_id);
     $items = $query->get();
     $queries = DB::getQueryLog();
     $last_query = end($queries)['query'];
     foreach ($items as $item) {
         $item->level = $level;
         $children = array();
         $this->buildTree($item->id, $children, $level + 1, $max_level, $include_children_count, $include_products_count);
         $item->children = $children;
         $container[] = $item;
     }
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:19,代码来源:CatalogService.php

示例5: output

 /**
  * Prints output
  *
  * @return null
  */
 private function output($raw = false)
 {
     $sColumns = array_merge_recursive($this->columns, $this->sColumns);
     $output = array("sEcho" => intval(Input::get('sEcho')), "iTotalRecords" => $this->count_all, "iTotalDisplayRecords" => $this->display_all, "aaData" => $this->result_array_r, "sColumns" => $sColumns);
     if (Config::get('app.debug', false)) {
         $output['aQueries'] = DB::getQueryLog();
     }
     if ($raw) {
         return $output;
     } else {
         return Response::json($output);
     }
 }
开发者ID:hilmysyarif,项目名称:l4-bootstrap-admin,代码行数:18,代码来源:Datatables.php

示例6: query_log

 public function query_log()
 {
     return DB::getQueryLog();
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:4,代码来源:Database.php

示例7: output

 /**
  * Prints output
  *
  * @param bool $raw If raw will output array data, otherwise json
  *
  * @return array|json
  */
 protected function output($raw = false)
 {
     if (Arr::get($this->input, 'version') == '1.10') {
         $output = array("draw" => intval($this->input['draw']), "recordsTotal" => $this->count_all, "recordsFiltered" => $this->display_all, "data" => $this->result_array_return);
     } else {
         $sColumns = array_merge_recursive($this->columns, $this->sColumns);
         $output = array("sEcho" => intval($this->input['draw']), "iTotalRecords" => $this->count_all, "iTotalDisplayRecords" => $this->display_all, "aaData" => $this->result_array_return, "sColumns" => $sColumns);
     }
     if (Config::get('app.debug', false)) {
         $output['aQueries'] = DB::getQueryLog();
     }
     if ($raw) {
         return $output;
     } else {
         return Response::json($output);
     }
 }
开发者ID:khaidirh,项目名称:laravel4-datatables-package,代码行数:24,代码来源:Datatables.php

示例8: verbose

 /**
  * Added the raw information from the game server. Used for debugging only.
  *
  * @return $this
  */
 private function verbose()
 {
     $serverinfo = $this->serverinfo;
     $this->data['_raw']['playerlist'] = $this->client->adminGetPlayerlist();
     for ($i = 0; $i < count($serverinfo); $i++) {
         $key = 'K' . $i;
         $this->data['_raw']['serverinfo'][$key] = $serverinfo[$i];
         if (is_numeric($this->data['_raw']['serverinfo'][$key])) {
             $this->data['_raw']['serverinfo'][$key] = intval($this->data['_raw']['serverinfo'][$key]);
         } else {
             if ($this->data['_raw']['serverinfo'][$key] == 'true' || $this->data['_raw']['serverinfo'][$key] == 'false') {
                 $this->data['_raw']['serverinfo'][$key] = $this->data['_raw']['serverinfo'][$key] == 'true' ? true : false;
             }
         }
     }
     $this->data['_raw']['sql_time'] = 0;
     $this->data['_raw']['sql'] = DB::getQueryLog();
     foreach ($this->data['_raw']['sql'] as $sql) {
         $this->data['_raw']['sql_time'] = $this->data['_raw']['sql_time'] + $sql['time'];
     }
     return $this;
 }
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:27,代码来源:LiveServerRepository.php

示例9: logSqlQueries

 /**
  * Log all executed queries into the log file.
  */
 protected function logSqlQueries()
 {
     if (!$this->isDebug()) {
         return;
     }
     $queries = DB::getQueryLog();
     foreach ($queries as $query) {
         $this->getLogger()->addInfo(json_encode($query));
     }
 }
开发者ID:mayconbordin,项目名称:reloquent,代码行数:13,代码来源:BaseRepository.php

示例10: inspect

 /**
  * Inspect a route.
  *
  * @param Client $client
  * @param string $route
  */
 protected function inspect(Client $client, $route)
 {
     try {
         $this->info('Inspecting ' . $route);
         $client->request('GET', $route);
     } catch (Exception $exception) {
         $this->error('Error inspecting ' . $route);
     }
     // Format and sort queries
     $routeQueries = DB::getQueryLog();
     $routeQueries = array_pluck($routeQueries, 'query');
     sort($routeQueries);
     // Cancel if no queries on this page
     if (empty($routeQueries)) {
         return;
     }
     // Store and flush
     $this->queries[$route]['response'] = $client->getResponse()->getContent();
     $this->queries[$route]['queries'] = $routeQueries;
     DB::flushQueryLog();
 }
开发者ID:anahkiasen,项目名称:arrounded,代码行数:27,代码来源:BenchQueries.php

示例11: statistics

 /**
  * Collecting statistics.
  *
  * 
  */
 public function statistics()
 {
     $this->statistics['queries'] = count(\Illuminate\Support\Facades\DB::getQueryLog());
     $this->statistics['loading'] = round(microtime(true) - LARAVEL_START, 4);
     $this->statistics['memory'] = number_format(memory_get_usage());
     $this->statistics['version'] = self::VEERVERSION;
     return $this->statistics;
 }
开发者ID:artemsk,项目名称:veer-core,代码行数:13,代码来源:VeerApp.php


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