summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com>2005-10-10 23:01:45 +0500
committerunknown <svoj@mysql.com>2005-10-10 23:01:45 +0500
commit57ef8576816c4104e519838bef09b9ad6a77842c (patch)
treeb3c98169097b984e4f88d7286ef3a3bc578dde24 /sql/unireg.cc
parent931771422fc713dea035aff0993c6223b53e7a55 (diff)
downloadmariadb-git-57ef8576816c4104e519838bef09b9ad6a77842c.tar.gz
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.
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index d297b143d3b..402d24a665b 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -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) ||