Fix type mismatch. Table names are represented as LEX_STRING
objects whose length is stored in a size_t type.
This commit is contained in:
parent
3cc56cb5ad
commit
a3d61b0bb2
@ -370,8 +370,8 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
|
||||
|
||||
|
||||
/* Check if a given table is opened log table */
|
||||
int check_if_log_table(uint db_len, const char *db, uint table_name_len,
|
||||
const char *table_name, uint check_if_opened)
|
||||
int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
|
||||
const char *table_name, bool check_if_opened)
|
||||
{
|
||||
if (db_len == 5 &&
|
||||
!(lower_case_table_names ?
|
||||
|
@ -499,8 +499,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
int check_if_log_table(uint db_len, const char *db, uint table_name_len,
|
||||
const char *table_name, uint check_if_opened);
|
||||
int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
|
||||
const char *table_name, bool check_if_opened);
|
||||
|
||||
class Log_to_csv_event_handler: public Log_event_handler
|
||||
{
|
||||
|
16
sql/table.cc
16
sql/table.cc
@ -2777,9 +2777,10 @@ bool check_db_name(LEX_STRING *org_name)
|
||||
*/
|
||||
|
||||
|
||||
bool check_table_name(const char *name, uint length)
|
||||
bool check_table_name(const char *name, size_t length)
|
||||
{
|
||||
uint name_length= 0; // name length in symbols
|
||||
// name length in symbols
|
||||
size_t name_length= 0;
|
||||
const char *end= name+length;
|
||||
if (!length || length > NAME_LEN)
|
||||
return 1;
|
||||
@ -2809,18 +2810,19 @@ bool check_table_name(const char *name, uint length)
|
||||
name_length++;
|
||||
}
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
return (last_char_is_space || name_length > NAME_CHAR_LEN) ;
|
||||
return last_char_is_space || (name_length > NAME_CHAR_LEN);
|
||||
#else
|
||||
return 0;
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool check_column_name(const char *name)
|
||||
{
|
||||
uint name_length= 0; // name length in symbols
|
||||
// name length in symbols
|
||||
size_t name_length= 0;
|
||||
bool last_char_is_space= TRUE;
|
||||
|
||||
|
||||
while (*name)
|
||||
{
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
@ -2845,7 +2847,7 @@ bool check_column_name(const char *name)
|
||||
name_length++;
|
||||
}
|
||||
/* Error if empty or too long column name */
|
||||
return last_char_is_space || (uint) name_length > NAME_CHAR_LEN;
|
||||
return last_char_is_space || (name_length > NAME_CHAR_LEN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
|
||||
bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
|
||||
bool check_db_name(LEX_STRING *db);
|
||||
bool check_column_name(const char *name);
|
||||
bool check_table_name(const char *name, uint length);
|
||||
bool check_table_name(const char *name, size_t length);
|
||||
int rename_file_ext(const char * from,const char * to,const char * ext);
|
||||
char *get_field(MEM_ROOT *mem, Field *field);
|
||||
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
|
||||
|
Loading…
x
Reference in New Issue
Block a user