summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 17ce6c629f1..8538372d607 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8911,6 +8911,7 @@ err:
TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
{
uint field_count= field_list.elements;
+ uint blob_count= 0;
Field **field;
create_field *cdef; /* column definition */
uint record_length= 0;
@@ -8927,6 +8928,12 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
table->s= s= &table->share_not_to_be_used;
s->fields= field_count;
+ if (!(s->blob_field= (uint*)thd->alloc((field_list.elements + 1) *
+ sizeof(uint))))
+ return 0;
+
+ s->blob_ptr_size= mi_portable_sizeof_char_ptr;
+
/* Create all fields and calculate the total length of record */
List_iterator_fast<create_field> it(field_list);
while ((cdef= it++))
@@ -8942,9 +8949,15 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
record_length+= (**field).pack_length();
if (! ((**field).flags & NOT_NULL_FLAG))
++null_count;
+
+ if ((*field)->flags & BLOB_FLAG)
+ s->blob_field[blob_count++]= (uint) (field - table->field);
+
++field;
}
*field= NULL; /* mark the end of the list */
+ s->blob_field[blob_count]= 0; /* mark the end of the list */
+ s->blob_fields= blob_count;
null_pack_length= (null_count + 7)/8;
s->reclength= record_length + null_pack_length;