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 procedure.cc.

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) 
 {
   DBUG_ENTER("proc_rownum_init");
 
   proc_rownum *pc = new proc_rownum(result);
 
   DBUG_RETURN(pc);
 }

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.