Skip to content

Commit 1dedd2a

Browse files
committed
Refactoring: check_log_table() split
1 parent 6a6709d commit 1dedd2a

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

sql/log.cc

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,21 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
730730
}
731731
}
732732

733+
734+
int check_if_log_table(const TABLE_LIST *table)
735+
{
736+
if (MYSQL_SCHEMA_NAME.streq(table->db))
737+
{
738+
if (GENERAL_LOG_NAME.streq(table->table_name))
739+
return QUERY_LOG_GENERAL;;
740+
741+
if (SLOW_LOG_NAME.streq(table->table_name))
742+
return QUERY_LOG_SLOW;
743+
}
744+
return 0;
745+
}
746+
747+
733748
/**
734749
Check if a given table is opened log table
735750
@@ -745,25 +760,9 @@ int check_if_log_table(const TABLE_LIST *table,
745760
bool check_if_opened,
746761
const char *error_msg)
747762
{
748-
int result= 0;
749-
if (MYSQL_SCHEMA_NAME.streq(table->db))
750-
{
751-
if (GENERAL_LOG_NAME.streq(table->table_name))
752-
{
753-
result= QUERY_LOG_GENERAL;
754-
goto end;
755-
}
756-
757-
if (SLOW_LOG_NAME.streq(table->table_name))
758-
{
759-
result= QUERY_LOG_SLOW;
760-
goto end;
761-
}
762-
}
763-
return 0;
764-
765-
end:
766-
if (!check_if_opened || logger.is_log_table_enabled(result))
763+
int result= check_if_log_table(table);
764+
if (result &&
765+
(!check_if_opened || logger.is_log_table_enabled(result)))
767766
{
768767
if (error_msg)
769768
my_error(ER_BAD_LOG_STATEMENT, MYF(0), error_msg);

sql/log.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ class Log_event_handler
10131013
};
10141014

10151015

1016+
int check_if_log_table(const TABLE_LIST *table);
10161017
int check_if_log_table(const TABLE_LIST *table, bool check_if_opened,
10171018
const char *errmsg);
10181019

0 commit comments

Comments
 (0)