@@ -12,42 +12,33 @@ class Query extends AbstractRenderer
1212 public function render (array $ data )
1313 {
1414 $ queries = collect (array_get ($ data , 'queries.statements ' , []));
15+ $ message = sprintf (
16+ '%s statements were executed in %s ' ,
17+ array_get ($ data , 'queries.nb_statements ' ),
18+ array_get ($ data , 'queries.accumulated_duration_str ' )
19+ );
1520
16- // Retrieve grouped sql statements
17- $ rows = $ queries
18- ->map (function ($ query , $ index ) {
19- return [
20- $ index ,
21- array_get ($ query , 'sql ' ),
22- array_get ($ query , 'duration_str ' ),
23- ];
24- })
25- ->all ();
21+ $ this ->output ->title ('Queries ' );
22+ $ this ->output ->writeln ($ message );
2623
2724 $ table = new Table ($ this ->output );
28-
29- $ this ->output ->writeln ('Queries executed: ' );
3025 $ table
3126 ->setHeaders ([
32- 'N. ' ,
3327 'SQL ' ,
3428 'Duration ' ,
29+ 'Statement ID ' ,
30+ 'connection ' ,
3531 ])
36- ->setRows ($ rows )
37- ->render ();
38-
39- $ this ->output ->writeln ('Queries summary: ' );
40- $ table
41- ->setHeaders ([
42- 'Total Number of Queries ' ,
43- 'Total Execution Time ' ,
44- ])
45- ->setRows ([
46- [
47- array_get ($ data , 'queries.nb_statements ' ),
48- array_get ($ data , 'queries.accumulated_duration_str ' )
49- ]
50- ])
32+ ->setRows (
33+ $ queries ->map (function ($ query , $ index ) {
34+ return [
35+ array_get ($ query , 'sql ' ),
36+ array_get ($ query , 'duration_str ' ),
37+ array_get ($ query , 'stmt_id ' ),
38+ str_limit (array_get ($ query , 'connection ' ), 20 ),
39+ ];
40+ })
41+ ->all ())
5142 ->render ();
5243 }
5344}
0 commit comments