← Back to team overview

maria-developers team mailing list archive

Re: MySQL: THDVAR in full-text parser

 

Hi, 0x00F6!

First: please send questions like this to maria-developers@xxxxxxxxxxxxxxxxxxx
it's a public mailing list dedicated to MySQL and MariaDB internals, source
code, and related things. I am subscribed, so I'll see you mail there, and you
may be sure I will, because it won't be accidentally catched by my spam filter,
or sorted out in some obscure folder. Furthermore other subscribers will see
your question and could reply if I will be not available (e.g. I could be
travelling).
Thank you.

On Nov 27, 0x00F6 - wrote:
> Hello Sergei,
> 
> Would you please help me in one small problem?
> I'm writing MySQL full-text parser plugin and I need to configure it
> by several session-level variables. So I need to execute THDVAR macro
> in my parse function. So how to obtain "thd" variable for this macro?

The server uses 'current_thd' in such a case.
It should probably be in the plugin.h, I'd say. But at the moment it is
not. You can copy the declaration from mysql_priv.h, something like this:

extern pthread_key_t THR_THD;
THD *current_thd() { return (THD*)pthread_getspecific(THR_THD); }

if you want it to work on windows, see mysql_priv.h for the complete
definition of current_thd.

Regards,
Sergei