mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#1324 table name to file name encoding
- Encoding itself, implemented as a charset "filename". Originally planned to use '.' as an escape character, but now changed to '@' for two reasons: "ls" does not return file names starting with '.' considering them as a kind of hidden files; some platforms do not allow several dots in a file name. - replacing many calls of my_snprintf() and strnxmov() to the new build_table_filename(). - Adding MY_APPEND_EXT mysys flag, to append an extention rather that replace it. - Replacing all numeric constants in fn_format flag arguments to their mysys definitions, e.g. MY_UNPACK_FILENAME, - Predictability in several function/methods: when a table name can appear with or withot .frm extension. Some functions/methods were changed so accept names strictly with .frm, other - strictly without .frm extensions. Several DBUG_ASSERTs were added to check whether an extension is passed. Many files: table name to file name encoding mysql_priv.h: Prototypes for new table name encoding tools. ctype-utf8.c: Implementing "filename" charset for table name to file name encoding. row0mysql.c: Fixing table name prefix. mf_format.c: Adding MY_APPEND_EXT processing. Many files: Fixing tests. my_sys.h: Adding new flag to append rather than replace an extension. m_ctype.h: Adding "filename" charset definition.
This commit is contained in:
@ -837,6 +837,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
char path[FN_REFLEN];
|
||||
TABLE *table;
|
||||
bool error;
|
||||
uint path_length;
|
||||
DBUG_ENTER("mysql_truncate");
|
||||
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
@ -867,9 +868,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
goto end;
|
||||
}
|
||||
|
||||
(void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
|
||||
table_list->table_name,reg_ext);
|
||||
fn_format(path, path, "", "", MY_UNPACK_FILENAME);
|
||||
path_length= build_table_filename(path, sizeof(path), table_list->db,
|
||||
table_list->table_name, reg_ext);
|
||||
|
||||
if (!dont_send_ok)
|
||||
{
|
||||
@ -889,7 +889,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
*fn_ext(path)=0; // Remove the .frm extension
|
||||
// Remove the .frm extension
|
||||
*(path + path_length - reg_ext_length)= '\0';
|
||||
error= ha_create_table(thd, path, table_list->db, table_list->table_name,
|
||||
&create_info, 1);
|
||||
query_cache_invalidate3(thd, table_list, 0);
|
||||
|
Reference in New Issue
Block a user