summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-11-05 13:20:35 +0200
committerunknown <monty@mysql.com>2005-11-05 13:20:35 +0200
commit9314a20745060e4915c6a253d7e58828f46e63bd (patch)
tree460c9bc04fe66682e1873d2b1e848a224ae7eb8d /sql/unireg.cc
parent2361720c981fc2eb27bc97c1ea7e043b634ffae1 (diff)
downloadmariadb-git-9314a20745060e4915c6a253d7e58828f46e63bd.tar.gz
Fix of crashed 5.1 tree (wrong merge + wrong pullout patch forced us to create a new 5.1 tree)
This is a merge of 5.0 -> 5.1 + some code from old 5.1 tree to get all tests to work and keep the .frm format the same as the old 5.1 tree. BitKeeper/etc/ignore: added libmysqld/sql_plugin.cc include/Makefile.am: Added plugin.hd include/m_ctype.h: Added my_strchr include/my_base.h: Added HA_USES_PARSER Merge with old 5.1 tree libmysqld/Makefile.am: Added sql_plugin.cc mysql-test/r/ndb_gis.result: Fixed results after merge sql/Makefile.am: Addes sql_plugin.h and sql_plugin.cc sql/ha_heap.h: Indentation fix sql/ha_partition.cc: Made partition_hton visible outside After merge fixes (for call to get_new_handler) sql/handler.cc: Added partition_hton to handlerton sql/handler.h: Added partion to handlerton Updated mysql_unpack_partion() from old 5.1 tree sql/mysql_priv.h: Added sql_plugin.h sql/records.cc: After merge fix sql/share/errmsg.txt: Added new errors messages from old 5.1 tree sql/sql_partition.cc: Removed compiler warnings Updated mysql_unpack_partition() from latest 5.1 tree sql/structs.h: Update KEY from latest 5.1 tree (to get table.cc to compile) sql/table.cc: Merged .frm format from 5.0, new 5.1 and old 5.1 tree (We now use same format as the old 5.1 tree) Note that this patch includes code for HA_USE_PARSER which is not usable until rest of 5.1 tree is restored sql/unireg.cc: Merged .frm format from 5.0, new 5.1 and old 5.1 tree (We now use same format as the old 5.1 tree) Note that this patch includes code for HA_USE_PARSER which is not usable until rest of 5.1 tree is restored strings/Makefile.am: Added my_strchr.c include/plugin.h: New BitKeeper file ``include/plugin.h'' sql/sql_plugin.cc: New BitKeeper file ``sql/sql_plugin.cc'' sql/sql_plugin.h: New BitKeeper file ``sql/sql_plugin.h'' strings/my_strchr.c: New BitKeeper file ``strings/my_strchr.c''
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc58
1 files changed, 43 insertions, 15 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 86f4b49292a..32f533a6072 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -77,14 +77,14 @@ bool mysql_create_frm(THD *thd, my_string file_name,
handler *db_file)
{
LEX_STRING str_db_type;
- uint reclength,info_length,screens,key_info_length,maxlength;
+ uint reclength,info_length,screens,key_info_length,maxlength,i;
ulong key_buff_length;
File file;
ulong filepos, data_offset;
uchar fileinfo[64],forminfo[288],*keybuff;
TYPELIB formnames;
uchar *screen_buff;
- char buff[2];
+ char buff[5];
#ifdef HAVE_PARTITION_DB
partition_info *part_info= thd->lex->part_info;
#endif
@@ -127,8 +127,21 @@ bool mysql_create_frm(THD *thd, my_string file_name,
/* 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);
+ /* str_db_type */
create_info->extra_size= (2 + str_db_type.length +
2 + create_info->connect_string.length);
+ /* Partition */
+ create_info->extra_size+= 5;
+#ifdef HAVE_PARTITION_DB
+ if (part_info)
+ create_info->extra_size+= part_info->part_info_len;
+#endif
+
+ for (i= 0; i < keys; i++)
+ {
+ if (key_info[i].parser_name)
+ create_info->extra_size+= key_info[i].parser_name->length + 1;
+ }
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
@@ -155,10 +168,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
#ifdef HAVE_PARTITION_DB
if (part_info)
- {
- int4store(fileinfo+55,part_info->part_info_len);
fileinfo[61]= (uchar) part_info->default_engine_type;
- }
#endif
int2store(fileinfo+59,db_file->extra_rec_buf_length());
if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) ||
@@ -173,31 +183,49 @@ bool mysql_create_frm(THD *thd, my_string file_name,
goto err;
int2store(buff, create_info->connect_string.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+ if (my_write(file, (const byte*)buff, 2, 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)) ||
+ if (my_write(file, (const byte*)buff, 2, 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) ||
- pack_fields(file, create_fields, data_offset))
- goto err;
#ifdef HAVE_PARTITION_DB
if (part_info)
{
- if (my_write(file, (byte*) part_info->part_info_string,
- part_info->part_info_len, MYF_RW))
+ int4store(buff, part_info->part_info_len);
+ if (my_write(file, (const byte*)buff, 4, MYF_RW) ||
+ my_write(file, (const byte*)part_info->part_info_string,
+ part_info->part_info_len + 1, MYF_RW))
goto err;
}
+ else
#endif
+ {
+ bzero(buff, 5);
+ if (my_write(file, (byte*) buff, 5, MYF_RW))
+ goto err;
+ }
+ for (i= 0; i < keys; i++)
+ {
+ if (key_info[i].parser_name)
+ {
+ if (my_write(file, (const byte*)key_info[i].parser_name->str,
+ key_info[i].parser_name->length + 1, 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) ||
+ pack_fields(file, create_fields, data_offset))
+ goto err;
+
#ifdef HAVE_CRYPTED_FRM
if (create_info->password)
{