File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
src/DebugBar/Resources/widgets/sqlqueries Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 1-
21div .phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-status {
32 font-family : monospace;
43 padding : 6px 6px ;
@@ -67,8 +66,17 @@ div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item span.phpdebu
6766 display : block;
6867 font-weight : bold;
6968}
69+
7070code .phpdebugbar-widgets-sql {
7171 white-space : pre-wrap;
7272 overflow-wrap : break-word;
7373 word-wrap : break-word;
74- }
74+ }
75+
76+ div .phpdebugbar-widgets-sqlqueries li .phpdebugbar-widgets-list-item .phpdebugbar-widgets-sql-duplicate {
77+ background-color : # ffd ;
78+ }
79+
80+ div .phpdebugbar-widgets-sqlqueries li .phpdebugbar-widgets-list-item .phpdebugbar-widgets-sql-duplicate : hover {
81+ background-color : # ffc ;
82+ }
Original file line number Diff line number Diff line change 5353 this . $list . set ( 'data' , data . statements ) ;
5454 this . $status . empty ( ) ;
5555
56+ // Search for duplicate statements.
57+ for ( var sql = { } , duplicate = 0 , i = 0 ; i < data . statements . length ; i ++ ) {
58+ var stmt = data . statements [ i ] . sql ;
59+ if ( data . statements [ i ] . params && ! $ . isEmptyObject ( data . statements [ i ] . params ) ) {
60+ stmt += ' {' + $ . param ( data . statements [ i ] . params , false ) + '}' ;
61+ }
62+ sql [ stmt ] = sql [ stmt ] || { keys : [ ] } ;
63+ sql [ stmt ] . keys . push ( i ) ;
64+ }
65+ // Add classes to all duplicate SQL statements.
66+ for ( var stmt in sql ) {
67+ if ( sql [ stmt ] . keys . length > 1 ) {
68+ duplicate ++ ;
69+ for ( var i = 0 ; i < sql [ stmt ] . keys . length ; i ++ ) {
70+ this . $list . $el . find ( '.' + csscls ( 'list-item' ) ) . eq ( sql [ stmt ] . keys [ i ] )
71+ . addClass ( csscls ( 'sql-duplicate' ) ) . addClass ( csscls ( 'sql-duplicate-' + duplicate ) ) ;
72+ }
73+ }
74+ }
75+
5676 var t = $ ( '<span />' ) . text ( data . nb_statements + " statements were executed" ) . appendTo ( this . $status ) ;
5777 if ( data . nb_failed_statements ) {
5878 t . append ( ", " + data . nb_failed_statements + " of which failed" ) ;
5979 }
80+ if ( duplicate ) {
81+ t . append ( ", " + duplicate + " of which were duplicated" ) ;
82+ }
6083 if ( data . accumulated_duration_str ) {
6184 this . $status . append ( $ ( '<span title="Accumulated duration" />' ) . addClass ( csscls ( 'duration' ) ) . text ( data . accumulated_duration_str ) ) ;
6285 }
You can’t perform that action at this time.
0 commit comments