Skip to content

Commit 20dbfbb

Browse files
committed
vcols: store flags first
1 parent 8f9530a commit 20dbfbb

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

sql/table.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,11 +2172,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
21722172
while (vcol_screen_pos < vcol_screen_end)
21732173
{
21742174
Virtual_column_info *vcol_info;
2175-
uint field_nr= uint2korr(vcol_screen_pos);
2176-
uint expr_length= uint2korr(vcol_screen_pos+2);
2177-
uint type= (uint) vcol_screen_pos[4];
2178-
uint name_length= (uint) vcol_screen_pos[5];
2179-
uint flags= (uint) vcol_screen_pos[6];
2175+
uint flags= (uint) vcol_screen_pos[0];
2176+
uint field_nr= uint2korr(vcol_screen_pos+1);
2177+
uint expr_length= uint2korr(vcol_screen_pos+3);
2178+
uint type= (uint) vcol_screen_pos[5];
2179+
uint name_length= (uint) vcol_screen_pos[6];
21802180
LEX_STRING name;
21812181
char *expr;
21822182

sql/unireg.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,27 +560,27 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
560560
pack_expression
561561
562562
The data is stored as:
563+
1 byte flags; VCOL_NON_DETERMINISTIC, etc
563564
2 bytes field_number
564565
2 bytes length of expression
565566
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
566567
1 byte length of name
567-
1 byte flags; 1 = non deterministic expression
568568
name
569569
next bytes column expression (text data)
570570
*/
571571

572572
static void pack_expression(uchar **buff, Virtual_column_info *vcol,
573573
uint offset, uint type)
574574
{
575-
int2store((*buff), offset);
575+
(*buff)[0]= vcol->flags;
576+
int2store((*buff)+1, offset);
576577
/*
577578
expr_str.length < 64K as we have checked that the total size of the
578579
frm file is < 64K
579580
*/
580-
int2store((*buff)+2, vcol->expr_str.length);
581-
(*buff)[4]= (uchar) type;
582-
(*buff)[5]= vcol->name.length;
583-
(*buff)[6]= vcol->flags;
581+
int2store((*buff)+3, vcol->expr_str.length);
582+
(*buff)[5]= (uchar) type;
583+
(*buff)[6]= vcol->name.length;
584584
(*buff)+= FRM_VCOL_NEW_HEADER_SIZE;
585585
memcpy((*buff), vcol->name.str, vcol->name.length);
586586
(*buff)+= vcol->name.length;

0 commit comments

Comments
 (0)