summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-06-10 22:30:49 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-06-10 22:30:49 -0300
commitd6e003545adb73c2d653ec4c9e17d4695dcfc12a (patch)
tree7aee99151209c7e83d2cf2ec0b242e6827f8c55f /sql/unireg.cc
parent222076528d1dc7dc4462787409f4107ab13bf5b2 (diff)
parent53b8829682307224a8b5a9de814019926eea9bd7 (diff)
downloadmariadb-git-d6e003545adb73c2d653ec4c9e17d4695dcfc12a.tar.gz
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index dbe4e8712ea..802e5b7429c 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -117,7 +117,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
File file;
ulong filepos, data_offset;
uchar fileinfo[64],forminfo[288],*keybuff;
- TYPELIB formnames;
uchar *screen_buff;
char buff[128];
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -128,7 +127,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
DBUG_ENTER("mysql_create_frm");
DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
- formnames.type_names=0;
+
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
DBUG_RETURN(1);
DBUG_ASSERT(db_file != NULL);
@@ -267,8 +266,15 @@ bool mysql_create_frm(THD *thd, const char *file_name,
key_buff_length= uint4korr(fileinfo+47);
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
- (void) get_form_pos(file,fileinfo,&formnames);
- if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
+
+ /*
+ Ensure that there are no forms in this newly created form file.
+ Even if the form file exists, create_frm must truncate it to
+ ensure one form per form file.
+ */
+ DBUG_ASSERT(uint2korr(fileinfo+8) == 0);
+
+ if (!(filepos= make_new_entry(file, fileinfo, NULL, "")))
goto err;
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
int2store(forminfo+2,maxlength);