[MDEV-26906] New capability flag for not sending parameter metadata Created: 2021-10-26 Updated: 2022-01-10 Resolved: 2022-01-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Protocol |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Georg Richter | Assignee: | Vladislav Vaintroub |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | CONNECTOR_RELATED | ||
| Description |
|
In response to COM_STMT_PREPARE the server sends back metadata (24 bytes) for each parameter in prepared statement. The metadata information is incomplete, has wrong values and cannot be used. Therefore the client api function mysql_stmt_param_metadata always returns a hardcoded NULL. Proposal: |
| Comments |
| Comment by Oleksandr Byelkin [ 2021-10-26 ] |
|
wlad what you think about it? |
| Comment by Vladislav Vaintroub [ 2021-10-26 ] |
|
What is the use case? If the question is again about something like execute_direct, I believe prepare+execute like now maybe suboptimal. I believe C/C should move on to more compact EXECUTE IMMEDIATE, but also learn to count parameter holders, aka questionmarks (neither in comments, nor in strings) itself. That is, if C/C still does not want to implement client-side prepared statements. As for the "can't be used", I beg to differ. In java, parameter metadata can be used, if implemented correctly . See https://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html |
| Comment by Vladislav Vaintroub [ 2021-10-28 ] |
|
As explained by georg over on Slack, the actual thing he wants, without any workarounds, is This would be an improvement over what is currently done with pipelining. I think this might perhaps even a better idea to provide a more generic and versatile COM_QUERY variation, where one can specify for example
This would cover the COM_EXECUTE_DIRECT needs, too, and in addition, georg's dream of never parsing text protocol might come true as well |
| Comment by Vladislav Vaintroub [ 2022-01-10 ] |
|
As we discussed, the actual thing you'd like to have is EXECUTE_DIRECT command. If this is so, let's create a different MDEV, about an extended and extendable COM_QUERY_EX which allows to define resultset encoding (binary vs text), and optionally pass query parameters, and other things, rather not spend valuable bits in the protocol for small single-use stuff for C client only. |
| Comment by Georg Richter [ 2022-01-10 ] |
|
Parameter junk has been sent over the wire for more than 17 years. Where is the problem to disable it, if client doesn't want to receive this garbage? |
| Comment by Vladislav Vaintroub [ 2022-01-10 ] |
|
The problem is that our protocol would further drift away from MySQL, for no good reason. Really, one can optimize much better if we optionally remove the "def" strings, that take much more space than this proposal. |
| Comment by Vladislav Vaintroub [ 2022-01-10 ] |
|
The general problem with those tiny requests, with each one consuming additional capability flag is that you'll soon run out of flags, trying to squeeze everything into existing COM_PREPARE or COM_EXECUTE. |