diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 67132e5ee4f..6bebf5d8676 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -685,7 +685,7 @@ int ha_partition::create(const char *name, TABLE *table_arg, handler **file, **abort_file; DBUG_ENTER("ha_partition::create"); - DBUG_ASSERT(*fn_rext((char*)name) == '\0'); + DBUG_ASSERT(!fn_frm_ext(name)); /* Not allowed to create temporary partitioned tables */ if (create_info && create_info->tmp_table()) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index d41e9acfdc8..f568db51b9c 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1725,8 +1725,7 @@ bool mysql_upgrade_db(THD *thd, LEX_CSTRING *old_db) DBUG_PRINT("info",("Examining: %s", file->name)); /* skiping non-FRM files */ - if (my_strcasecmp(files_charset_info, - (extension= fn_rext(file->name)), reg_ext)) + if (!(extension= (char*) fn_frm_ext(file->name))) continue; /* A frm file found, add the table info rename list */ diff --git a/sql/table.cc b/sql/table.cc index 13ba1b43732..fee76721b9f 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -217,31 +217,26 @@ static uchar *get_field_name(Field **buff, size_t *length, Returns pointer to '.frm' extension of the file name. SYNOPSIS - fn_rext() + fn_frm_ext() name file name DESCRIPTION Checks file name part starting with the rightmost '.' character, and returns it if it is equal to '.frm'. - TODO - It is a good idea to get rid of this function modifying the code - to garantee that the functions presently calling fn_rext() always - get arguments in the same format: either with '.frm' or without '.frm'. - RETURN VALUES - Pointer to the '.frm' extension. If there is no extension, - or extension is not '.frm', pointer at the end of file name. + Pointer to the '.frm' extension or NULL if not a .frm file */ -char *fn_rext(char *name) +const char *fn_frm_ext(const char *name) { - char *res= strrchr(name, '.'); + const char *res= strrchr(name, '.'); if (res && !strcmp(res, reg_ext)) return res; - return name + strlen(name); + return 0; } + TABLE_CATEGORY get_table_category(const LEX_CSTRING *db, const LEX_CSTRING *name) { diff --git a/sql/table.h b/sql/table.h index 94a161eefba..19845efe40d 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2702,7 +2702,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); void append_unescaped(String *res, const char *pos, uint length); void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys, KEY *key_info); -char *fn_rext(char *name); +const char *fn_frm_ext(const char *name); /* Check that the integer is in the internal */ static inline int set_zone(int nr,int min_zone,int max_zone)