It might be even better to build this as a UDF that could be loaded without a new server. Example:
SELECT SET_VARIABLE(<THREAD_ID>, <VARIABLE>, <VALUE>); SELECT GET_VARIABLE(...........);
If <THREAD_ID> is zero, then SET_VARIABLE() should set the variable for every thread.
It might be even better to build this as a UDF that could be loaded without a new server. Example:
SELECT SET_VARIABLE( <THREAD_ ID>, <VARIABLE>, <VALUE>); ....... ....);
SELECT GET_VARIABLE(
If <THREAD_ID> is zero, then SET_VARIABLE() should set the variable for every thread.