MySQL Internals Manual  /  ...  /  change_columns()

18.1.2 change_columns()

Prototype: virtual bool change_columns(List<Item> &field_list);

Here you can change the structure of the result field list, for example, you can add fields to the field_list or replace the queries result fields by something completely different alltogether (like PROCEDURE ANALYSE() does).

An example that adds an INTEGER field at the end of the field list:

bool proc_rownum::change_columns(List<Item> &field_list)

   // create a new column item
   row_num_column = new Item_proc_int("RowNum");

   // and attach it to the column list