Commit 06acd7a2 authored by Sergei Golubchik's avatar Sergei Golubchik

don't save vcol flags in frm

this is useless now, flags are recalculated on load anyway.
But storing flags on disk means we cannot easily change (add,
remove, or renumber) them in the new MariaDB version.
parent c3e06381
......@@ -396,7 +396,7 @@ enum Derivation
/* The length of the header part for each virtual column in the .frm file */
#define FRM_VCOL_OLD_HEADER_SIZE(b) (3 + MY_TEST(b))
#define FRM_VCOL_NEW_BASE_SIZE 16
#define FRM_VCOL_NEW_HEADER_SIZE 7
#define FRM_VCOL_NEW_HEADER_SIZE 6
class Count_distinct_field;
......
......@@ -2172,11 +2172,10 @@ 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 flags= (uint) vcol_screen_pos[0];
uint type= (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];
uint name_length= (uint) vcol_screen_pos[5];
LEX_STRING name;
char *expr;
......@@ -2208,8 +2207,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
vcol_info->expr_str.str= expr;
vcol_info->expr_str.length= expr_length;
vcol_screen_pos+= expr_length;
vcol_info->flags= flags;
vcol_info->stored_in_db= 0;
switch (type) {
case 0: // Generated virtual field
......
......@@ -560,10 +560,9 @@ 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
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
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
name
next bytes column expression (text data)
......@@ -572,15 +571,14 @@ 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)
{
(*buff)[0]= vcol->flags;
(*buff)[0]= (uchar) type;
int2store((*buff)+1, offset);
/*
expr_str.length < 64K as we have checked that the total size of the
frm file is < 64K
*/
int2store((*buff)+3, vcol->expr_str.length);
(*buff)[5]= (uchar) type;
(*buff)[6]= vcol->name.length;
(*buff)[5]= vcol->name.length;
(*buff)+= FRM_VCOL_NEW_HEADER_SIZE;
memcpy((*buff), vcol->name.str, 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