void run_explain(struct st_connection *cn, struct st_command *command,
                 int flags, bool json)
{
  if ((flags & QUERY_REAP_FLAG) &&
      !command->expected_errors.count &&
      match_re(&explain_re, command->query))
  {
    st_command save_command= *command;
    DYNAMIC_STRING query_str;
    DYNAMIC_STRING ds_warning_messages;

    init_dynamic_string(&ds_warning_messages, "", 0, 2048);
    init_dynamic_string(&query_str, json ? "EXPLAIN FORMAT=JSON "
                                         : "EXPLAIN EXTENDED ", 256, 256);
    dynstr_append_mem(&query_str, command->query,
                      command->end - command->query);
    
    command->query= query_str.str;
    command->query_len= query_str.length;
    command->end= strend(command->query);

    run_query(cn, command, flags);

    dynstr_free(&query_str);
    dynstr_free(&ds_warning_messages);

    *command= save_command;
  }
}
void run_explain(struct st_connection *cn, struct st_command *command,
                 int flags, bool json)
{
  if ((flags & QUERY_REAP_FLAG) &&
      !command->expected_errors.count &&
      match_re(&explain_re, command->query))
  {
    st_command save_command= *command;
    DYNAMIC_STRING query_str;
    DYNAMIC_STRING ds_warning_messages;

    init_dynamic_string(&ds_warning_messages, "", 0, 2048);
    init_dynamic_string(&query_str, json ? "EXPLAIN FORMAT=JSON "
                                         : "EXPLAIN EXTENDED ", 256, 256);
    dynstr_append_mem(&query_str, command->query,
                      command->end - command->query);
    
    command->query= query_str.str;
    command->query_len= query_str.length;
    command->end= strend(command->query);

    run_query(cn, command, flags);

    dynstr_free(&query_str);
    dynstr_free(&ds_warning_messages);

    *command= save_command;
  }
}