Hi! To clarify things a bit:
"Sergei" == Sergei Golubchik <serg@mariadb.org> writes:
Sergei> Hi, Rich! Sergei> On Sep 12, Rich Prohaska wrote:
i have a MYSQL_THDVAR_STR session variable in my storage engine. i want to update its value from the storage engine. it was suggested that i use "THDVAR(x)=new_value" to do it. i noticed that update_func_str is NOT called, so i wonder about the contract. is the caller responsible for memory management? i used PLUGIN_VAR_MEMALLOC for the var def.
Sergei> Yes. When you assign from your code, it's just a normal assignment. Sergei> You can assign anything you want. Which of course means that you have to take care of the memory management of any value you assign. Sergei> The update function is called when a value is assigned from SQL, like Sergei> with Sergei> SET @@session.engine_x = new_value If the variable is something the user also can assign a value, then you should use my_malloc()/my_strdup() to allocate the value and mark the variable with PLUGIN_VAR_MEMALLOC (see update_func_str()). If the variable is readonly, then you can assign the variable anything and just free things when your storage engine unloads. Regards, Monty