Bug #90420 | Contribution by Facebook: Query attributes | ||
---|---|---|---|
Submitted: | 13 Apr 2018 0:21 | Modified: | 18 Jan 2021 12:26 |
Reporter: | FBContrib Admin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Connection Handling | Severity: | S4 (Feature request) |
Version: | 8.0.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[13 Apr 2018 0:21]
FBContrib Admin
[13 Apr 2018 0:21]
FBContrib Admin
Query attributes (*) This code is contributed under the Facebook agreement
Contribution: fb_patch_43.txt (text/plain), 20.84 KiB.
[1 Oct 2018 22:27]
FBContrib Admin
Query attributes for 8.0.11 (*) This code is contributed under the Facebook agreement
Contribution: fb_patch_83.txt (text/plain), 22.16 KiB.
[18 Jan 2021 8:17]
Georgi Kodinov
Implemented as WL#12542 in 8.0.23
[18 Jan 2021 12:26]
Paul DuBois
Posted by developer: Fixed in 8.0.23. For some applications, it may be useful to define metadata on a per-query basis. Examples include the URL of the page that produced a query, or extra processing information to be passed with a query for use by a plugin such as an audit plugin or query rewrite plugin. MySQL now supports this capability without the use of workarounds such as specially formatted comments included in query strings: * On the client side, the mysql_bind_param() C API function enables defining query attributes. These attributes apply to the next SQL statement sent to the server for execution. Additionally, the mysql and mysqltest clients have a query_attributes command that enables defining query attributes. * On the server side, a component service provides access to query attributes. A component named query_attributes uses this service to implement a mysql_query_attribute_string() user-defined function (UDF) that enables obtaining attribute values within SQL statements. The query_attributes component is optional but must be installed for the UDF to be available. Thanks to Facebook for suggesting the idea (and for contributing code, although it was not used).