Skip to content

Commit

Permalink
vcols: store flags first
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 30, 2016
1 parent 8f9530a commit 20dbfbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions sql/unireg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,27 @@ 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)
*/

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;
Expand Down

0 comments on commit 20dbfbb

Please sign in to comment.