Cleanup: Remove ib_lock_t::type_mode_string()

This commit is contained in:
Marko Mäkelä 2021-01-15 16:32:37 +02:00
parent 462cb66662
commit b32f057da7
2 changed files with 32 additions and 53 deletions

View file

@ -64,61 +64,44 @@ operator<<(std::ostream& out, const lock_table_t& lock)
return(lock.print(out));
}
/** Convert the member 'type_mode' into a human readable string.
@return human readable string */
inline
std::string
ib_lock_t::type_mode_string() const
{
std::ostringstream sout;
sout << type_string();
static_assert(LOCK_MODE_MASK == 7, "compatibility");
static_assert(LOCK_IS == 0, "compatibility");
static_assert(LOCK_IX == 1, "compatibility");
static_assert(LOCK_S == 2, "compatibility");
static_assert(LOCK_X == 3, "compatibility");
static_assert(LOCK_AUTO_INC == 4, "compatibility");
static_assert(LOCK_NONE == 5, "compatibility");
static_assert(LOCK_NONE_UNSET == 7, "compatibility");
const char * const modes[8] = {
"IS", "IX", "S", "X", "AUTO_INC", "NONE", "?", "NONE_UNSET"
};
sout << " | LOCK_" << modes[mode()];
if (is_record_not_gap()) {
sout << " | LOCK_REC_NOT_GAP";
}
if (is_waiting()) {
sout << " | LOCK_WAIT";
}
if (is_gap()) {
sout << " | LOCK_GAP";
}
if (is_insert_intention()) {
sout << " | LOCK_INSERT_INTENTION";
}
return(sout.str());
}
inline
std::ostream&
ib_lock_t::print(std::ostream& out) const
{
out << "[lock_t: type_mode=" << type_mode << "("
<< type_mode_string() << ")";
static_assert(LOCK_MODE_MASK == 7, "compatibility");
static_assert(LOCK_IS == 0, "compatibility");
static_assert(LOCK_IX == 1, "compatibility");
static_assert(LOCK_S == 2, "compatibility");
static_assert(LOCK_X == 3, "compatibility");
static_assert(LOCK_AUTO_INC == 4, "compatibility");
static_assert(LOCK_NONE == 5, "compatibility");
static_assert(LOCK_NONE_UNSET == 7, "compatibility");
const char *const modes[8]=
{ "IS", "IX", "S", "X", "AUTO_INC", "NONE", "?", "NONE_UNSET" };
if (is_record_lock()) {
out << un_member.rec_lock;
} else {
out << un_member.tab_lock;
}
out << "[lock_t: type_mode=" << type_mode << "(" << type_string()
<< " | LOCK_" << modes[mode()];
out << "]";
return(out);
if (is_record_not_gap())
out << " | LOCK_REC_NOT_GAP";
if (is_waiting())
out << " | LOCK_WAIT";
if (is_gap())
out << " | LOCK_GAP";
if (is_insert_intention())
out << " | LOCK_INSERT_INTENTION";
out << ")";
if (is_record_lock())
out << un_member.rec_lock;
else
out << un_member.tab_lock;
out << "]";
return out;
}
inline

View file

@ -225,10 +225,6 @@ struct ib_lock_t
@return the given output stream. */
std::ostream& print(std::ostream& out) const;
/** Convert the member 'type_mode' into a human readable string.
@return human readable string */
std::string type_mode_string() const;
const char* type_string() const
{
switch (type_mode & LOCK_TYPE_MASK) {