當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。