diff options
author | unknown <knielsen@knielsen-hq.org> | 2012-11-20 13:57:49 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2012-11-20 13:57:49 +0100 |
commit | ecf04668a2db3d7fc91e421e68eeb5ab25064aa0 (patch) | |
tree | 67fb1a5b050c913ad21f9c30628ff3ef0fd81f2c /sql/table.cc | |
parent | dd2d59924e06afb29e36a6dda56f6fb393ef6c6e (diff) | |
parent | cbae294396429682a22371f23a048dcd0d4c71da (diff) | |
download | mariadb-git-ecf04668a2db3d7fc91e421e68eeb5ab25064aa0.tar.gz |
Merge MariaDB 5.2->5.3
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sql/table.cc b/sql/table.cc index faa248f43f6..d42fd14120c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5801,22 +5801,25 @@ size_t max_row_length(TABLE *table, const uchar *data) @param thd Thread handle @param table The TABLE object - @param for_write Requests to compute only fields needed for write + @param vcol_update_mode Specifies what virtual column are computed @details The function computes the values of the virtual columns of the table and stores them in the table record buffer. - Only fields from vcol_set are computed, and, when the flag for_write is not - set to TRUE, a virtual field is computed only if it's not stored. - The flag for_write is set to TRUE for row insert/update operations. - + If vcol_update_mode is set to VCOL_UPDATE_ALL then all virtual column are + computed. Otherwise, only fields from vcol_set are computed: all of them, + if vcol_update_mode is set to VCOL_UPDATE_FOR_WRITE, and, only those with + the stored_in_db flag set to false, if vcol_update_mode is equal to + VCOL_UPDATE_FOR_READ. + @retval 0 Success @retval >0 Error occurred when storing a virtual field value */ -int update_virtual_fields(THD *thd, TABLE *table, bool for_write) +int update_virtual_fields(THD *thd, TABLE *table, + enum enum_vcol_update_mode vcol_update_mode) { DBUG_ENTER("update_virtual_fields"); Field **vfield_ptr, *vfield; @@ -5829,9 +5832,9 @@ int update_virtual_fields(THD *thd, TABLE *table, bool for_write) { vfield= (*vfield_ptr); DBUG_ASSERT(vfield->vcol_info && vfield->vcol_info->expr_item); - /* Only update those fields that are marked in the vcol_set bitmap */ - if (bitmap_is_set(table->vcol_set, vfield->field_index) && - (for_write || !vfield->stored_in_db)) + if ((bitmap_is_set(table->vcol_set, vfield->field_index) && + (vcol_update_mode == VCOL_UPDATE_FOR_WRITE || !vfield->stored_in_db)) || + vcol_update_mode == VCOL_UPDATE_ALL) { /* Compute the actual value of the virtual fields */ error= vfield->vcol_info->expr_item->save_in_field(vfield, 0); |