Commit 83043c3c authored by svoj@mysql.com's avatar svoj@mysql.com

Always save/restore connect string.

parent eb8ab300
...@@ -316,17 +316,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -316,17 +316,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
my_free(buff, MYF(0)); my_free(buff, MYF(0));
goto err; goto err;
} }
if (share->db_type == DB_TYPE_FEDERATED_DB) share->connect_string.length= uint2korr(buff);
if (! (share->connect_string.str= strmake_root(&outparam->mem_root,
next_chunk + 2, share->connect_string.length)))
{ {
share->connect_string.length= uint2korr(buff); my_free(buff, MYF(0));
if (! (share->connect_string.str= strmake_root(&outparam->mem_root, goto err;
next_chunk + 2, share->connect_string.length)))
{
my_free(buff, MYF(0));
goto err;
}
next_chunk+= share->connect_string.length + 2;
} }
next_chunk+= share->connect_string.length + 2;
buff_end= buff + n_length; buff_end= buff + n_length;
if (next_chunk + 2 < buff_end) if (next_chunk + 2 < buff_end)
{ {
......
...@@ -122,8 +122,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, ...@@ -122,8 +122,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
str_db_type.str= (char *)ha_get_storage_engine(create_info->db_type); str_db_type.str= (char *)ha_get_storage_engine(create_info->db_type);
str_db_type.length= strlen(str_db_type.str); str_db_type.length= strlen(str_db_type.str);
create_info->extra_size= 2 + str_db_type.length; 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;
create_info->extra_size+= create_info->connect_string.length + 2;
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0) create_info, keys)) < 0)
...@@ -159,14 +158,12 @@ bool mysql_create_frm(THD *thd, my_string file_name, ...@@ -159,14 +158,12 @@ bool mysql_create_frm(THD *thd, my_string file_name,
create_fields,reclength, data_offset)) create_fields,reclength, data_offset))
goto err; goto err;
if (create_info->db_type == DB_TYPE_FEDERATED_DB) int2store(buff, create_info->connect_string.length);
{ if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
int2store(buff, create_info->connect_string.length); my_write(file, (const byte*)create_info->connect_string.str,
if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) || create_info->connect_string.length, MYF(MY_NABP)))
my_write(file, (const byte*)create_info->connect_string.str,
create_info->connect_string.length, MYF(MY_NABP)))
goto err; goto err;
}
int2store(buff, str_db_type.length); int2store(buff, str_db_type.length);
if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) || if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
my_write(file, (const byte*)str_db_type.str, my_write(file, (const byte*)str_db_type.str,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment