summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorbar@mysql.com <>2005-12-31 09:01:26 +0400
committerbar@mysql.com <>2005-12-31 09:01:26 +0400
commit6ff211329f8c513c2b8ec7e3ef1652e1ff7d7b8c (patch)
tree6a3476c826545341821fbccb1f42ba381c5ca30a /sql/unireg.cc
parent83d8979ca28da67a054fff6c8f9e127e38f26ecb (diff)
downloadmariadb-git-6ff211329f8c513c2b8ec7e3ef1652e1ff7d7b8c.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.
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 66be20736e8..7b15e14bdaf 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -93,6 +93,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
thd->lex->part_info= NULL;
#endif
+ DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
formnames.type_names=0;
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
DBUG_RETURN(1);
@@ -289,7 +290,7 @@ err3:
SYNOPSIS
rea_create_table()
thd Thread handler
- path Name of file (including database and .frm)
+ path Name of file (including database, without .frm)
db Data base name
table_name Table name
create_info create info parameters
@@ -309,25 +310,26 @@ int rea_create_table(THD *thd, const char *path,
List<create_field> &create_fields,
uint keys, KEY *key_info, handler *file)
{
- char *ext;
DBUG_ENTER("rea_create_table");
- if (mysql_create_frm(thd, path, db, table_name, create_info,
+ char frm_name[FN_REFLEN];
+ strxmov(frm_name, path, reg_ext, NullS);
+ if (mysql_create_frm(thd, frm_name, db, table_name, create_info,
create_fields, keys, key_info, file))
+
DBUG_RETURN(1);
+
+ // Make sure mysql_create_frm din't remove extension
+ DBUG_ASSERT(*fn_rext(frm_name));
if (file->create_handler_files(path))
goto err_handler;
- *(ext= fn_ext(path))= 0; // Remove .frm
if (!create_info->frm_only && ha_create_table(thd, path, db, table_name,
create_info,0))
- {
- *ext= FN_EXTCHAR; // Add extension back
goto err_handler;
- }
DBUG_RETURN(0);
err_handler:
- my_delete(path, MYF(0));
+ my_delete(frm_name, MYF(0));
DBUG_RETURN(1);
} /* rea_create_table */