1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Store and read engine type string in extra block of .frm.

sql/handler.cc:
  Use my_strnncoll instead of my_strcasecmp (it is possible to
  compare non-asciiz strings now).
sql/handler.h:
  extra block size added to HA_CREATE_INFO.
This commit is contained in:
unknown
2005-10-10 23:01:45 +05:00
parent 931771422f
commit 57ef857681
4 changed files with 72 additions and 33 deletions

View File

@@ -75,6 +75,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
uint keys, KEY *key_info,
handler *db_file)
{
LEX_STRING str_db_type;
uint reclength,info_length,screens,key_info_length,maxlength;
ulong key_buff_length;
File file;
@@ -82,6 +83,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
uchar fileinfo[64],forminfo[288],*keybuff;
TYPELIB formnames;
uchar *screen_buff;
char buff[2];
DBUG_ENTER("mysql_create_frm");
formnames.type_names=0;
@@ -116,6 +118,13 @@ bool mysql_create_frm(THD *thd, my_string file_name,
}
reclength=uint2korr(forminfo+266);
/* Calculate extra data segment length */
str_db_type.str= (char *)ha_get_storage_engine(create_info->db_type);
str_db_type.length= strlen(str_db_type.str);
create_info->extra_size= 2 + str_db_type.length;
if (create_info->db_type == DB_TYPE_FEDERATED_DB)
create_info->extra_size+= create_info->connect_string.length + 2;
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
{
@@ -149,16 +158,21 @@ bool mysql_create_frm(THD *thd, my_string file_name,
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
create_fields,reclength, data_offset))
goto err;
if (create_info->connect_string.length)
if (create_info->db_type == DB_TYPE_FEDERATED_DB)
{
char buff[2];
int2store(buff,create_info->connect_string.length);
int2store(buff, create_info->connect_string.length);
if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
my_write(file, (const byte*)create_info->connect_string.str,
create_info->connect_string.length, MYF(MY_NABP)))
goto err;
}
int2store(buff, str_db_type.length);
if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
my_write(file, (const byte*)str_db_type.str,
str_db_type.length, MYF(MY_NABP)))
goto err;
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||