@@ -495,35 +495,35 @@ public function cli( $_, $assoc_args ) {
495495 * +---------+-----------------------+
496496 */
497497 public function query ( $ args , $ assoc_args ) {
498-
498+
499499 $ command = sprintf ( '/usr/bin/env mysql%s --no-auto-rehash ' , $ this ->get_defaults_flag_string ( $ assoc_args ) );
500500 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
501-
501+
502502 $ assoc_args ['database ' ] = DB_NAME ;
503-
503+
504504 // The query might come from STDIN.
505505 if ( ! empty ( $ args ) ) {
506506 $ assoc_args ['execute ' ] = $ args [0 ];
507507 }
508-
508+
509509 if ( isset ( $ assoc_args ['execute ' ] ) ) {
510510 // Ensure that the SQL mode is compatible with WPDB.
511511 $ assoc_args ['execute ' ] = $ this ->get_sql_mode_query ( $ assoc_args ) . $ assoc_args ['execute ' ];
512512 }
513-
513+
514514 $ is_row_modifying_query = isset ( $ assoc_args ['execute ' ] ) && preg_match ( '/\b(UPDATE|DELETE|INSERT|REPLACE|LOAD DATA)\b/i ' , $ assoc_args ['execute ' ] );
515-
515+
516516 if ( $ is_row_modifying_query ) {
517517 $ assoc_args ['execute ' ] .= '; SELECT ROW_COUNT(); ' ;
518518 }
519-
519+
520520 WP_CLI ::debug ( 'Associative arguments: ' . json_encode ( $ assoc_args ), 'db ' );
521521 list ( $ stdout , $ stderr , $ exit_code ) = self ::run ( $ command , $ assoc_args , false );
522-
522+
523523 if ( $ exit_code ) {
524524 WP_CLI ::error ( "Query failed: {$ stderr }" );
525525 }
526-
526+
527527 if ( $ is_row_modifying_query ) {
528528 $ output_lines = explode ( "\n" , trim ( $ stdout ) );
529529 $ affected_rows = (int ) trim ( end ( $ output_lines ) );
0 commit comments