vcols: store flags first

This commit is contained in:
Sergei Golubchik 2016-06-29 20:18:04 +02:00
parent 8f9530a9ab
commit 20dbfbb49c
2 changed files with 11 additions and 11 deletions

View File

@ -2172,11 +2172,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
while (vcol_screen_pos < vcol_screen_end)
{
Virtual_column_info *vcol_info;
uint field_nr= uint2korr(vcol_screen_pos);
uint expr_length= uint2korr(vcol_screen_pos+2);
uint type= (uint) vcol_screen_pos[4];
uint name_length= (uint) vcol_screen_pos[5];
uint flags= (uint) vcol_screen_pos[6];
uint flags= (uint) vcol_screen_pos[0];
uint field_nr= uint2korr(vcol_screen_pos+1);
uint expr_length= uint2korr(vcol_screen_pos+3);
uint type= (uint) vcol_screen_pos[5];
uint name_length= (uint) vcol_screen_pos[6];
LEX_STRING name;
char *expr;

View File

@ -560,11 +560,11 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
pack_expression
The data is stored as:
1 byte flags; VCOL_NON_DETERMINISTIC, etc
2 bytes field_number
2 bytes length of expression
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
1 byte length of name
1 byte flags; 1 = non deterministic expression
name
next bytes column expression (text data)
*/
@ -572,15 +572,15 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
static void pack_expression(uchar **buff, Virtual_column_info *vcol,
uint offset, uint type)
{
int2store((*buff), offset);
(*buff)[0]= vcol->flags;
int2store((*buff)+1, offset);
/*
expr_str.length < 64K as we have checked that the total size of the
frm file is < 64K
*/
int2store((*buff)+2, vcol->expr_str.length);
(*buff)[4]= (uchar) type;
(*buff)[5]= vcol->name.length;
(*buff)[6]= vcol->flags;
int2store((*buff)+3, vcol->expr_str.length);
(*buff)[5]= (uchar) type;
(*buff)[6]= vcol->name.length;
(*buff)+= FRM_VCOL_NEW_HEADER_SIZE;
memcpy((*buff), vcol->name.str, vcol->name.length);
(*buff)+= vcol->name.length;