@@ -122,9 +122,43 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *)
122122struct st_mysql_sys_var ;
123123struct st_mysql_value ;
124124
125+ /*
126+ SYNOPSIS
127+ (*mysql_var_check_func)()
128+ thd thread handle
129+ var dynamic variable being altered
130+ save pointer to temporary storage
131+ value user provided value
132+ RETURN
133+ 0 user provided value is OK and the update func may be called.
134+ any other value indicates error.
135+
136+ This function should parse the user provided value and store in the
137+ provided temporary storage any data as required by the update func.
138+ There is sufficient space in the temporary storage to store a double.
139+ Note that the update func may not be called if any other error occurs
140+ so any memory allocated should be thread-local so that it may be freed
141+ automatically at the end of the statement.
142+ */
143+
125144typedef int (*mysql_var_check_func)(MYSQL_THD thd,
126145 struct st_mysql_sys_var *var,
127146 void *save, struct st_mysql_value *value);
147+
148+ /*
149+ SYNOPSIS
150+ (*mysql_var_update_func)()
151+ thd thread handle
152+ var dynamic variable being altered
153+ var_ptr pointer to dynamic variable
154+ save pointer to temporary storage
155+ RETURN
156+ NONE
157+
158+ This function should use the validated value stored in the temporary store
159+ and persist it in the provided pointer to the dynamic variable.
160+ For example, strings may require memory to be allocated.
161+ */
128162typedef void (*mysql_var_update_func)(MYSQL_THD thd,
129163 struct st_mysql_sys_var *var,
130164 void *var_ptr, void *save);
@@ -582,6 +616,10 @@ struct st_mysql_information_schema
582616 st_mysql_value struct for reading values from mysqld.
583617 Used by server variables framework to parse user-provided values.
584618 Will be used for arguments when implementing UDFs.
619+
620+ Note that val_str() returns a string in temporary memory
621+ that will be freed at the end of statement. Copy the string
622+ if you need it to persist.
585623*/
586624
587625#define MYSQL_VALUE_TYPE_STRING 0
0 commit comments