Hi!
>>>>> "Patrick" == Patrick Lau <patro02@stripped> writes:
Patrick> Hi
Patrick> For our purpose we want to free Items during query execution.
Patrick> So my idea would be:
Patrick> 1) instantiate item with malloc:
Patrick> Item* tmp_item = (Item*)malloc(sizeof(Item));
Patrick> 2) invoke copy constructor
Patrick> List_iterator_fast<Item> it(*join->fields);
Patrick> item1=it++;
tmp_item-> Item(*item1);
May not work in the future as we are likely to prohibit the usage of
copy constructors (as this leads to error with normal usage of items).
Patrick> now the question:
Patrick> - how would the copy constructor Item(& item) look like - especially
Patrick> for join->result->send_data(...)....
Patrick> - Is it a good idea?
Probably not.
Patrick> Does a similiar method already exist?
A better way would be to create a separate 'arena' for your items that
you then free all at once with the free_items() call.
This way you can free a group of items at once, any time during the
execution.
Look at the Query_arena() class in sql_class.cc
This is how we ensure that item's in prepared statements that we don't
want to free at the same time as the items used when executing the query.
Regards,
Monty
MySQL + Maria + more = MariaDB
| Thread |
|---|
| • Deep copy of Item | Patrick Lau | 18 Mar |
| • re: Deep copy of Item | Michael Widenius | 8 Apr |