> So it's a rather lousy solution, and I
> hoped you could come up with
> something better :)
Well i can think of something composed from __FILE__ __LINE__.
It'll provide the information about the connection's origin, which
will be enought in 99% of cases. Unfortunately that
Still it won't be clear what plugin of possible many utilizing that
code is actually doing the call. There's no information about it anywhere
on the stack or arguments.
It's possible to add that argument to THD - like current_plugin and
set it befor the call to the plugin function. Though it seems
way too much work to just set the name for the connection's user.
So i think just the 'username' argument to the mysql_real_connect_local()
is the nicest way out. BTW the mysql_real_connect() has this argument.
> The server doesn't have to use *plugin services*, services are an API
> for plugins to use.
No need to use the 'services' infrastructure indeed. But the functions
that are exported with the services are often called in the server.
> It's to avoid boilerplate, to not force plugins to
> tell the server what the server already knows.
...
> well, the point was to identify what plugin makes the call.
> and almost always it will be a plugin name.
As we discussed it's not trivial for the server to get that
data. And just one extra argument to the function call doesn't seem
to be a complication.
Oherwise we can use just 'sql_service' username for everybody.
Since there is just few clients working at the moment, it's
usually possible to figure out from the log what plugin it was.
> No, using pluginname@'' can hardly be correct. ''@'' is more reasonable.
> And it's not only definer, it's what CURRENT_USER shows, it's what
> privileges are used. Surely, not privileges of the pluginname@''
> account, there is no such account. So CURRENT_USER should not be
> pluginname@''.
Ok, that'll work.
The CURRENT_USER is empty, so the default DEFINER for the VIEW/PROCEDURE.
Regards.
HF