summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-12-31 09:01:26 +0400
committerunknown <bar@mysql.com>2005-12-31 09:01:26 +0400
commit9c7412cae85e2fde1959902c574241308cc71ecd (patch)
tree6a3476c826545341821fbccb1f42ba381c5ca30a /sql/ha_berkeley.cc
parent80d3e73466c170f09618fffe1ea800274ea49c3f (diff)
downloadmariadb-git-9c7412cae85e2fde1959902c574241308cc71ecd.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/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 900372a2204..01d6ceed3f2 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -699,7 +699,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
if ((error= db_env->txn_begin(db_env, NULL, (DB_TXN**) &transaction, 0)) ||
(error= (file->open(file, transaction,
fn_format(name_buff, name, "", ha_berkeley_ext,
- 2 | 4),
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
"main", DB_BTREE, open_mode, 0))) ||
(error= transaction->commit(transaction, 0)))
{
@@ -2093,7 +2093,8 @@ int ha_berkeley::create(const char *name, register TABLE *form,
int error;
DBUG_ENTER("ha_berkeley::create");
- fn_format(name_buff,name,"", ha_berkeley_ext,2 | 4);
+ fn_format(name_buff,name,"", ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT);
/* Create the main table that will hold the real rows */
if ((error= create_sub_table(name_buff,"main",DB_BTREE,0)))
@@ -2142,8 +2143,9 @@ int ha_berkeley::delete_table(const char *name)
if ((error=db_create(&file, db_env, 0)))
my_errno=error; /* purecov: inspected */
else
- error=file->remove(file,fn_format(name_buff,name,"",ha_berkeley_ext,2 | 4),
- NULL,0);
+ error=file->remove(file,fn_format(name_buff,name,"",ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
+ NULL,0);
file=0; // Safety
DBUG_RETURN(error);
}
@@ -2161,9 +2163,11 @@ int ha_berkeley::rename_table(const char * from, const char * to)
{
/* On should not do a file->close() after rename returns */
error= file->rename(file,
- fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4),
+ fn_format(from_buff, from, "",
+ ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
NULL, fn_format(to_buff, to, "", ha_berkeley_ext,
- 2 | 4), 0);
+ MY_UNPACK_FILENAME|MY_APPEND_EXT), 0);
}
return error;
}
@@ -2413,7 +2417,8 @@ int ha_berkeley::check(THD* thd, HA_CHECK_OPT* check_opt)
(hidden_primary_key ? berkeley_cmp_hidden_key :
berkeley_cmp_packed_key));
tmp_file->app_private= (void*) (table->key_info+table->primary_key);
- fn_format(name_buff,share->table_name.str,"", ha_berkeley_ext, 2 | 4);
+ fn_format(name_buff,share->table_name.str,"", ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT);
if ((error=tmp_file->verify(tmp_file, name_buff, NullS, (FILE*) 0,
hidden_primary_key ? 0 : DB_NOORDERCHK)))
{
@@ -2559,7 +2564,8 @@ void ha_berkeley::get_status()
char name_buff[FN_REFLEN];
uint open_mode= (((table->db_stat & HA_READ_ONLY) ? DB_RDONLY : 0)
| DB_THREAD);
- fn_format(name_buff, share->table_name, "", ha_berkeley_ext, 2 | 4);
+ fn_format(name_buff, share->table_name, "", ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT);
if (!db_create(&share->status_block, db_env, 0))
{
if (share->status_block->open(share->status_block, NULL, name_buff,
@@ -2641,7 +2647,8 @@ static void update_status(BDB_SHARE *share, TABLE *table)
share->status_block->set_flags(share->status_block,0); /* purecov: inspected */
if (share->status_block->open(share->status_block, NULL,
fn_format(name_buff,share->table_name,
- "", ha_berkeley_ext,2 | 4),
+ "", ha_berkeley_ext,
+ MY_UNPACK_FILENAME|MY_APPEND_EXT),
"status", DB_BTREE,
DB_THREAD | DB_CREATE, my_umask)) /* purecov: inspected */
goto end; /* purecov: inspected */