mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +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:
@@ -568,8 +568,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
String str(buff,(uint32) sizeof(buff), system_charset_info);
|
||||
char md5[MD5_BUFF_LENGTH];
|
||||
bool can_be_merged;
|
||||
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN];
|
||||
LEX_STRING dir, file;
|
||||
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN], path_buff[FN_REFLEN];
|
||||
LEX_STRING dir, file, path;
|
||||
DBUG_ENTER("mysql_register_view");
|
||||
|
||||
/* print query */
|
||||
@@ -584,15 +584,17 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
DBUG_PRINT("info", ("View: %s", str.ptr()));
|
||||
|
||||
/* print file name */
|
||||
(void) my_snprintf(dir_buff, FN_REFLEN, "%s/%s/",
|
||||
mysql_data_home, view->db);
|
||||
unpack_filename(dir_buff, dir_buff);
|
||||
dir.length= build_table_filename(dir_buff, sizeof(dir_buff),
|
||||
view->db, "", "");
|
||||
dir.str= dir_buff;
|
||||
dir.length= strlen(dir_buff);
|
||||
|
||||
file.str= file_buff;
|
||||
file.length= (strxnmov(file_buff, FN_REFLEN-1, view->table_name, reg_ext,
|
||||
NullS) - file_buff);
|
||||
path.length= build_table_filename(path_buff, sizeof(path_buff),
|
||||
view->db, view->table_name, reg_ext);
|
||||
path.str= path_buff;
|
||||
|
||||
file.str= path.str + dir.length;
|
||||
file.length= path.length - dir.length;
|
||||
|
||||
/* init timestamp */
|
||||
if (!view->timestamp.str)
|
||||
view->timestamp.str= view->timestamp_buffer;
|
||||
@@ -1184,9 +1186,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
{
|
||||
TABLE_SHARE *share;
|
||||
bool type= 0;
|
||||
strxnmov(path, FN_REFLEN-1, mysql_data_home, "/", view->db, "/",
|
||||
view->table_name, reg_ext, NullS);
|
||||
(void) unpack_filename(path, path);
|
||||
build_table_filename(path, sizeof(path),
|
||||
view->db, view->table_name, reg_ext);
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (access(path, F_OK) ||
|
||||
(type= (mysql_frm_type(thd, path, ¬_used) != FRMTYPE_VIEW)))
|
||||
|
||||
Reference in New Issue
Block a user