diff options
author | Igor Babaev <igor@askmonty.org> | 2013-01-15 16:46:27 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-01-15 16:46:27 -0800 |
commit | f8f90aa75fbe8ab5c543d788f2afe55926ae34cb (patch) | |
tree | 5f16ed4c43926f8ac51e00babdc48bd1b8100476 /sql/sql_insert.cc | |
parent | bd87fed1dc0caa0720e5a60f0fca1b714c58ac75 (diff) | |
download | mariadb-git-f8f90aa75fbe8ab5c543d788f2afe55926ae34cb.tar.gz |
Fixed bug mdev-3938.
The original patch with the implementation of virtual columns
did not support INSERT DELAYED into tables with virtual columns.
This patch fixes the problem.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9962789029e..f76c2252eb9 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2084,6 +2084,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) { my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; + Field **vfield; TABLE *copy; TABLE_SHARE *share; uchar *bitmap; @@ -2127,12 +2128,20 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!copy_tmp) goto error; + if (share->vfields) + { + vfield= (Field **) client_thd->alloc((share->vfields+1)*sizeof(Field*)); + if (!vfield) + goto error; + } + /* Copy the TABLE object. */ copy= new (copy_tmp) TABLE; *copy= *table; /* We don't need to change the file handler here */ /* Assign the pointers for the field pointers array and the record. */ field= copy->field= (Field**) (copy + 1); + copy->vfield= vfield; bitmap= (uchar*) (field + share->fields + 1); copy->record[0]= (bitmap + share->column_bitmap_size*3); memcpy((char*) copy->record[0], (char*) table->record[0], share->reclength); @@ -2156,6 +2165,26 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) } *field=0; + if (table->vfield) + { + for (field= copy->field; *field; field++) + { + if ((*field)->vcol_info) + { + bool error_reported= FALSE; + if (unpack_vcol_info_from_frm(client_thd, + client_thd->mem_root, + copy, + *field, + &(*field)->vcol_info->expr_str, + &error_reported)) + goto error; + *vfield++= *field; + } + } + *vfield= 0; + } + /* Adjust timestamp */ if (table->timestamp_field) { |