*** mysql-4.1.bk-orig/sql/table.cc Mon Apr 2 12:10:55 2007 --- mysql-4.1.bk/sql/table.cc Mon Apr 2 12:42:51 2007 *************** *** 26,34 **** static void frm_error(int error,TABLE *form,const char *name, int errortype, int errarg); static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, ! uint types, char **names); static uint find_field(TABLE *form,uint start,uint length); static byte* get_field_name(Field **buff,uint *length, --- 26,34 ---- static void frm_error(int error,TABLE *form,const char *name, int errortype, int errarg); static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, ! uint types, char **names, int max_names = 0); static uint find_field(TABLE *form,uint start,uint length); static byte* get_field_name(Field **buff,uint *length, *************** *** 398,406 **** } } if (keynames) ! fix_type_pointers(&int_array,&outparam->keynames,1,&keynames); VOID(my_close(file,MYF(MY_WME))); file= -1; record=(char*) outparam->record[0]-1; /* Fieldstart = 1 */ --- 398,406 ---- } } if (keynames) ! fix_type_pointers(&int_array,&outparam->keynames,1,&keynames, keys); VOID(my_close(file,MYF(MY_WME))); file= -1; record=(char*) outparam->record[0]-1; /* Fieldstart = 1 */ *************** *** 1078,1103 **** */ static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types, ! char **names) { char *type_name, *ptr; char chr; ptr= *names; while (types--) { point_to_type->name=0; point_to_type->type_names= *array; if ((chr= *ptr)) /* Test if empty type */ { ! while ((type_name=strchr(ptr+1,chr)) != NullS) { ! *((*array)++) = ptr+1; ! *type_name= '\0'; /* End string */ ! ptr=type_name; } ptr+=2; /* Skip end mark and last 0 */ } else --- 1078,1107 ---- */ static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types, ! char **names, int max_names) { char *type_name, *ptr; char chr; + int cnt; ptr= *names; while (types--) { + cnt= 0; point_to_type->name=0; point_to_type->type_names= *array; if ((chr= *ptr)) /* Test if empty type */ { ! while ((type_name=strchr(ptr+1,chr)) != NullS ! && (max_names == 0 || cnt < max_names)) { ! *((*array)++) = ptr+1; ! *type_name= '\0'; /* End string */ ! ptr=type_name; ! cnt++; } ptr+=2; /* Skip end mark and last 0 */ } else *************** *** 1282,1290 **** fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= FRM_VER+3; // Header fileinfo[3]= (uchar) ha_checktype(create_info->db_type); fileinfo[4]=1; int2store(fileinfo+6,IO_SIZE); /* Next block starts here */ ! key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength)); int4store(fileinfo+10,length); if (key_length > 0xffff) key_length=0xffff; int2store(fileinfo+14,key_length); --- 1286,1307 ---- fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= FRM_VER+3; // Header fileinfo[3]= (uchar) ha_checktype(create_info->db_type); fileinfo[4]=1; int2store(fileinfo+6,IO_SIZE); /* Next block starts here */ ! /* ! for each key: (see unireq.cc pack_keys) ! 8 Bytes for the key header ! 9 Bytes for each key-part (MAX_REF_PARTS) ! NAME_LEN Bytes for the name ! 1 Byte for the NAMES_SEP_CHAR (in front of the name) ! For all keys ! 6 for the header ! 1 for the NAMES_SEP_CHAR (behind the last name) ! 1 for the 00 byte to terminate the combined names string ! QQ "+16" makes 8 byte remainder from old code ! A copy of this line is in unireq.cc (Keep it in sync) ! */ ! key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength)); int4store(fileinfo+10,length); if (key_length > 0xffff) key_length=0xffff; int2store(fileinfo+14,key_length); *** mysql-4.1.bk-orig/sql/unireg.cc Mon Apr 2 12:10:55 2007 --- mysql-4.1.bk/sql/unireg.cc Mon Apr 2 12:41:33 2007 *************** *** 123,131 **** my_free((gptr) screen_buff,MYF(0)); DBUG_RETURN(1); } ! uint key_buff_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; 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,""))) --- 123,132 ---- my_free((gptr) screen_buff,MYF(0)); DBUG_RETURN(1); } ! /* Keep the next line in sync with it's copy in table.cc */ ! uint key_buff_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; 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,""))) *** mysql-4.1.bk-orig/myisam/mi_open.c Mon Apr 2 12:10:30 2007 --- mysql-4.1.bk/myisam/mi_open.c Mon Apr 2 12:13:02 2007 *************** *** 218,226 **** } key_parts+=fulltext_keys*FT_SEGS; if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY || ! key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG) { DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); my_errno=HA_ERR_UNSUPPORTED; goto err; --- 218,226 ---- } key_parts+=fulltext_keys*FT_SEGS; if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY || ! key_parts > MI_MAX_KEY * MI_MAX_KEY_SEG) { DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); my_errno=HA_ERR_UNSUPPORTED; goto err;