MySQL Internals Manual  /  Writing a Procedure  /  Initialization Callback

18.2 Initialization Callback

The initialization callback is registered together with the procedure name in the sql_procs array in

The initialization callback prototype signature looks like this:

 Procedure *(*init)(THD *thd,ORDER *param,select_result *result,
List<Item> &field_list);

In the initialization callback you usually just create and return an instance of your derived Procedure class:

// Create and register the actual procedure object
 Procedure *proc_rownum_init(THD *thd, 
                             ORDER *param, 
                             select_result *result,
 			     List<Item> &field_list) 
   proc_rownum *pc = new proc_rownum(result);