Re: Per field encoding
Posted by: Filipe Silva
Date: May 06, 2024 04:23PM

Quote

What I am confused about is that setString handles it this deviating encoding correctly, while setCharacterStream does not. How can that be?

That's just how MySQL Server handles big-size data.

By submitting data through `setString()` you are telling the driver to send it attached to the MySQL protocol command COM_STMT_EXECUTE which is encoded using the session character set; while `setCharacterStream()` sends the data isolated via COM_STMT_SEND_LONG_DATA, which is binary encoded, and then followed by the corresponding `COM_STMT_EXECUTE` that actually runs the query. This difference makes the server handle character sets differently and, hence, two distinct connection properties for encoding configurations.

In theory, the connector could encode the character stream data using the target encoding as returned from the server in the query preparation phase, however, like I explained before, this only works with server-side prepared statements and if we used this information, then client-side and server-side prepared statements would behave differently (see useServerPrepStmts for more details) and we can't allow that.

Options: ReplyQuote


Subject
Written By
Posted
May 02, 2024 05:39AM
May 03, 2024 05:02AM
May 03, 2024 06:46AM
May 06, 2024 03:58AM
Re: Per field encoding
May 06, 2024 04:23PM
May 10, 2024 07:17AM
May 10, 2024 10:58AM
May 10, 2024 11:03AM
May 13, 2024 06:51PM
May 13, 2024 11:56PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.