Uses 0 params in write_query_format_1()

When logging COM_STMT_EXECUTE parameters, we check stored parameters.
In the unexpected event (it should never happen) that either `session`
or `session->CurrentQuery.stmt_meta` are `nullptr` , we log 0 parameters
to ensure a deterministic format in the query logging file.
pull/4895/head
René Cannaò 1 year ago
parent d913cb9972
commit 39031f614b

@ -768,6 +768,11 @@ uint64_t MySQL_Event::write_query_format_1(std::fstream *f) {
// Add the raw bytes of the parameter value.
total_bytes += value_len;
}
} else {
// Deterministic binary logging: always report 0 parameters.
uint16_t num_params = 0;
uint8_t paramCountLen = mysql_encode_length(num_params, buf);
total_bytes += paramCountLen;
}
}
@ -921,6 +926,11 @@ uint64_t MySQL_Event::write_query_format_1(std::fstream *f) {
f->write(convertedValue.data(), value_len);
}
}
} else {
// Deterministic binary logging: always report 0 parameters.
uint16_t num_params = 0;
uint8_t paramCountLen = mysql_encode_length(num_params, buf);
f->write((char *)buf, paramCountLen);
}
}

Loading…
Cancel
Save