[CONJ-1052] regression in 3.x.y: parameterized batch in multiquery mode "SET @name := ?; INSERT INTO products( name ) VALUES ( @name )" fails Created: 2023-02-07 Updated: 2023-03-01 |
|
| Status: | Open |
| Project: | MariaDB Connector/J |
| Component/s: | 2.7 compatibility |
| Affects Version/s: | 3.1.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Dmitriy Pichugin | Assignee: | Diego Dupin |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
win10pro[64bit], 10.5.4-MariaDB, java8 |
||
| Attachments: |
|
| Description |
|
regression. OUTPUT when fails with connector driver ver. 3.1.2:
|
| Comments |
| Comment by Diego Dupin [ 2023-03-01 ] |
|
This is a known problem, resulting from a clear choice in favor of performance for version 3. Now, when setting option `useServerPrepStmts`, prepared statement really only use PREPARE + EXECUTE. in 2.x behaviour was this one :
And as a workaround for command that cannot be prepared, when prepare fails, use client-side prepare statement in place of server prepare statement. This was the case for you example when using 2.x driver: connector did send a PREPARE command that result in an error, then use TEXT protocol. This was slow, but working in every cases. with the 3 version, this works differently:
Problem is connector now throw an exception for command that cannot be PREPAREd server side. There has been lots of work done server side in order to permit commands to be PREPAREd (like This choice improve prepare statement so much, i don't think it's a good idea to revert that change. One thing that can be done is adding hints: This is not perfect, but can permit to solve some use-cases. |