File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/DebugBar/Resources/widgets/sqlqueries Expand file tree Collapse file tree 1 file changed +20
-0
lines changed 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+ sql [ stmt ] = sql [ stmt ] || { keys : [ ] } ;
60+ sql [ stmt ] . keys . push ( i ) ;
61+ }
62+ // Add classes to all duplicate SQL statements.
63+ for ( var stmt in sql ) {
64+ if ( sql [ stmt ] . keys . length > 1 ) {
65+ duplicate ++ ;
66+ for ( var i = 0 ; i < sql [ stmt ] . keys . length ; i ++ ) {
67+ this . $list . $el . find ( '.' + csscls ( 'list-item' ) ) . eq ( sql [ stmt ] . keys [ i ] )
68+ . addClass ( csscls ( 'sql-duplicate' ) ) . addClass ( csscls ( 'sql-duplicate-' + duplicate ) ) ;
69+ }
70+ }
71+ }
72+
5673 var t = $ ( '<span />' ) . text ( data . nb_statements + " statements were executed" ) . appendTo ( this . $status ) ;
5774 if ( data . nb_failed_statements ) {
5875 t . append ( ", " + data . nb_failed_statements + " of which failed" ) ;
5976 }
77+ if ( duplicate ) {
78+ t . append ( ", " + duplicate + " of which were duplicates" ) ;
79+ }
6080 if ( data . accumulated_duration_str ) {
6181 this . $status . append ( $ ( '<span title="Accumulated duration" />' ) . addClass ( csscls ( 'duration' ) ) . text ( data . accumulated_duration_str ) ) ;
6282 }
You can’t perform that action at this time.
0 commit comments