diff options
author | unknown <bar@mysql.com> | 2005-12-31 09:01:26 +0400 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-12-31 09:01:26 +0400 |
commit | 8762c036a8154ef015546e495944378a3329c021 (patch) | |
tree | 6a3476c826545341821fbccb1f42ba381c5ca30a /sql/sql_db.cc | |
parent | 97b856981c4c1684ce5de1fcc1ab0bce101af5c9 (diff) | |
download | mariadb-git-8762c036a8154ef015546e495944378a3329c021.tar.gz |
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.
include/m_ctype.h:
Adding "filename" charset definition.
include/my_sys.h:
Adding new flag to append rather than replace an extension.
mysql-test/t/alter_table.test:
Fixing tests.
mysql-test/t/create.test:
Fixing tests.
mysql-test/t/show_check.test:
Fixing tests.
mysql-test/r/alter_table.result:
Fixing tests.
mysql-test/r/create.result:
Fixing tests.
mysql-test/r/mysqldump.result:
Fixing tests.
mysys/mf_format.c:
Adding MY_APPEND_EXT processing.
sql/discover.cc:
table name to file name encoding
sql/ha_berkeley.cc:
table name to file name encoding
sql/ha_innodb.cc:
table name to file name encoding
sql/ha_myisam.cc:
table name to file name encoding
sql/ha_myisammrg.cc:
table name to file name encoding
sql/ha_ndbcluster.cc:
table name to file name encoding
sql/ha_partition.cc:
table name to file name encoding
sql/handler.cc:
table name to file name encoding.
sql/init.cc:
table name to file name encoding
sql/mysqld.cc:
table name to file name encoding
sql/parse_file.cc:
table name to file name encoding
sql/sql_acl.cc:
table name to file name encoding
sql/sql_base.cc:
table name to file name encoding
sql/sql_db.cc:
table name to file name encoding
sql/sql_delete.cc:
table name to file name encoding
sql/sql_rename.cc:
table name to file name encoding
sql/sql_show.cc:
table name to file name encoding
sql/sql_table.cc:
table name to file name encoding
sql/sql_trigger.cc:
table name to file name encoding
sql/sql_view.cc:
table name to file name encoding
sql/strfunc.cc:
table name to file name encoding
sql/table.cc:
table name to file name encoding
sql/unireg.cc:
table name to file name encoding
storage/innobase/row/row0mysql.c:
Fixing table name prefix.
,
storage/myisam/mi_create.c:
table name to file name encoding
storage/myisam/mi_delete_table.c:
table name to file name encoding
storage/myisam/mi_open.c:
table name to file name encoding
storage/myisam/mi_rename.c:
table name to file name encoding
strings/ctype-utf8.c:
Implementing "filename" charset for
table name to file name encoding.
sql/mysql_priv.h:
Prototypes for new table name encoding tools.
storage/myisammrg/myrg_create.c:
table name to file name encoding
storage/myisammrg/myrg_open.c:
table name to file name encoding
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 0e6c0c45cf1..d91f091174f 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -425,8 +425,7 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, } /* Check directory */ - strxmov(path, mysql_data_home, "/", db, NullS); - path_len= unpack_dirname(path,path); // Convert if not unix + path_len= build_table_filename(path, sizeof(path), db, "", ""); path[path_len-1]= 0; // Remove last '/' from path if (my_stat(path,&stat_info,MYF(0))) @@ -549,9 +548,12 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) if ((error=wait_if_global_read_lock(thd,0,1))) goto exit2; - /* Check directory */ - strxmov(path, mysql_data_home, "/", db, "/", MY_DB_OPT_FILE, NullS); - fn_format(path, path, "", "", MYF(MY_UNPACK_FILENAME)); + /* + Recreate db options file: /dbpath/.db.opt + We pass MY_DB_OPT_FILE as "extension" to avoid + "table name to file name" encoding. + */ + build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE); if ((error=write_db_opt(thd, path, create_info))) goto exit; @@ -629,8 +631,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) goto exit2; } - (void) sprintf(path,"%s/%s",mysql_data_home,db); - length= unpack_dirname(path,path); // Convert if not unix + length= build_table_filename(path, sizeof(path), db, "", ""); strmov(path+length, MY_DB_OPT_FILE); // Append db option file name del_dbopt(path); // Remove dboption hash entry path[length]= '\0'; // Remove file name @@ -852,7 +853,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, found_other_files++; continue; } - extension= fn_ext(file->name); + if (!(extension= strrchr(file->name, '.'))) + extension= strend(file->name); if (find_type(extension, &deletable_extentions,1+2) <= 0) { if (find_type(extension, ha_known_exts(),1+2) <= 0) @@ -870,7 +872,9 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, if (!table_list) goto err; table_list->db= (char*) (table_list+1); - strmov(table_list->table_name= strmov(table_list->db,db)+1, file->name); + table_list->table_name= strmov(table_list->db, db) + 1; + VOID(filename_to_tablename(file->name, table_list->table_name, + strlen(file->name) + 1)); table_list->alias= table_list->table_name; // If lower_case_table_names=2 /* Link into list */ (*tot_list_next)= table_list; @@ -1151,8 +1155,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check) } } #endif - (void) sprintf(path,"%s/%s",mysql_data_home,dbname); - length=unpack_dirname(path,path); // Convert if not unix + length= build_table_filename(path, sizeof(path), dbname, "", ""); if (length && path[length-1] == FN_LIBCHAR) path[length-1]=0; // remove ending '\' if (my_access(path,F_OK)) |