Commit 20dbfbb4 authored by Sergei Golubchik's avatar Sergei Golubchik

vcols: store flags first

parent 8f9530a9
...@@ -2172,11 +2172,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -2172,11 +2172,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
while (vcol_screen_pos < vcol_screen_end) while (vcol_screen_pos < vcol_screen_end)
{ {
Virtual_column_info *vcol_info; Virtual_column_info *vcol_info;
uint field_nr= uint2korr(vcol_screen_pos); uint flags= (uint) vcol_screen_pos[0];
uint expr_length= uint2korr(vcol_screen_pos+2); uint field_nr= uint2korr(vcol_screen_pos+1);
uint type= (uint) vcol_screen_pos[4]; uint expr_length= uint2korr(vcol_screen_pos+3);
uint name_length= (uint) vcol_screen_pos[5]; uint type= (uint) vcol_screen_pos[5];
uint flags= (uint) vcol_screen_pos[6]; uint name_length= (uint) vcol_screen_pos[6];
LEX_STRING name; LEX_STRING name;
char *expr; char *expr;
......
...@@ -560,11 +560,11 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr, ...@@ -560,11 +560,11 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
pack_expression pack_expression
The data is stored as: The data is stored as:
1 byte flags; VCOL_NON_DETERMINISTIC, etc
2 bytes field_number 2 bytes field_number
2 bytes length of expression 2 bytes length of expression
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check) 1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
1 byte length of name 1 byte length of name
1 byte flags; 1 = non deterministic expression
name name
next bytes column expression (text data) next bytes column expression (text data)
*/ */
...@@ -572,15 +572,15 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr, ...@@ -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, static void pack_expression(uchar **buff, Virtual_column_info *vcol,
uint offset, uint type) 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 expr_str.length < 64K as we have checked that the total size of the
frm file is < 64K frm file is < 64K
*/ */
int2store((*buff)+2, vcol->expr_str.length); int2store((*buff)+3, vcol->expr_str.length);
(*buff)[4]= (uchar) type; (*buff)[5]= (uchar) type;
(*buff)[5]= vcol->name.length; (*buff)[6]= vcol->name.length;
(*buff)[6]= vcol->flags;
(*buff)+= FRM_VCOL_NEW_HEADER_SIZE; (*buff)+= FRM_VCOL_NEW_HEADER_SIZE;
memcpy((*buff), vcol->name.str, vcol->name.length); memcpy((*buff), vcol->name.str, vcol->name.length);
(*buff)+= vcol->name.length; (*buff)+= vcol->name.length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment