diff options
author | Igor Babaev <igor@askmonty.org> | 2012-06-23 15:00:05 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-06-23 15:00:05 -0700 |
commit | 20f3f4a273202ef539314acbbdbb67ab91376ab6 (patch) | |
tree | 4081cb30864a2cdf9184bdc8c31216d2c7ce2947 /sql/table.cc | |
parent | e7bfda3b3cc59ba3fe4fe7e7e4307704a464f97f (diff) | |
parent | d9c3a3e39e4c5a6f060b7bbc1646ca74c123fbab (diff) | |
download | mariadb-git-20f3f4a273202ef539314acbbdbb67ab91376ab6.tar.gz |
Merge 5.2->5.3
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/table.cc b/sql/table.cc index ff104103374..05fb5593842 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1257,25 +1257,33 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { /* Get virtual column data stored in the .frm file as follows: - byte 1 = 1 (always 1 to allow for future extensions) + byte 1 = 1 | 2 byte 2 = sql_type byte 3 = flags (as of now, 0 - no flags, 1 - field is physically stored) - byte 4-... = virtual column expression (text data) + [byte 4] = optional interval_id for sql_type (only if byte 1 == 2) + next byte ... = virtual column expression (text data) */ vcol_info= new Virtual_column_info(); - if ((uint)vcol_screen_pos[0] != 1) + bool opt_interval_id= (uint)vcol_screen_pos[0] == 2; + field_type= (enum_field_types) (uchar) vcol_screen_pos[1]; + if (opt_interval_id) + interval_nr= (uint)vcol_screen_pos[3]; + else if ((uint)vcol_screen_pos[0] != 1) { error= 4; goto free_and_err; } - field_type= (enum_field_types) (uchar) vcol_screen_pos[1]; fld_stored_in_db= (bool) (uint) vcol_screen_pos[2]; - vcol_expr_length= vcol_info_length-(uint)FRM_VCOL_HEADER_SIZE; + vcol_expr_length= vcol_info_length - + (uint)(FRM_VCOL_HEADER_SIZE(opt_interval_id)); if (!(vcol_info->expr_str.str= (char *)memdup_root(&share->mem_root, - vcol_screen_pos+(uint)FRM_VCOL_HEADER_SIZE, + vcol_screen_pos + + (uint) FRM_VCOL_HEADER_SIZE(opt_interval_id), vcol_expr_length))) goto free_and_err; + if (opt_interval_id) + interval_nr= (uint) vcol_screen_pos[3]; vcol_info->expr_str.length= vcol_expr_length; vcol_screen_pos+= vcol_info_length; share->vfields++; |