[MDEV-13504] CONNECT engine table_type=JDBC with UPDATE of NCAHR, NVARCHAR columns not working Created: 2017-08-11  Updated: 2017-10-13

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.1.26
Fix Version/s: 10.1

Type: Bug Priority: Major
Reporter: Robert Dyas Assignee: Olivier Bertrand
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Centos7



 Description   

With 10.1.26 and a Microsoft JDBC driver, the NCHAR and NVARCHAR column types do correctly INSERT foreign characters (INSERT AND SELECT both produce correct values). However with an UPDATE statement the data comes through as ??? rather than the actual characters.



 Comments   
Comment by Robert Dyas [ 2017-08-15 ]

Hi Olivier,

Have you had a chance to look into this?

Comment by Olivier Bertrand [ 2017-08-16 ]

I just updated the mytest and myntext columns of the all_types table.

Apparently it worked whether or not the DATA_CHARSET option is set to UTF8 (it was set to utf8 when I updated line 6 and to latin1 when updating line 7) However, the table is displayed correctly only with DATA_CHARSET=utf8.

Comment by Robert Dyas [ 2017-08-16 ]

I'm not sure I follow that.... In 10.1.26:

  1. SELECT works for NCHAR, NVARCHAR – > doesn't work for NTEXT (but you've already fixed)
  2. INSERT works for NCHAR, NVARCHAR, NTEXT (the latter is surprising but true... just verified again)
  3. UPDATE with foreign characters --> doesn't work for any of the N-types (does work with basic characters)
  4. WHERE clause parameters with foreign characters (myNVARCHAR = 'ส') --> doesn't work for any of the N-types (does work with basic characters)

I'm guessing there is something different about how you encode INSERT vs. UPDATE statements (seem to remember this from an earlier discussion).

Comment by Olivier Bertrand [ 2017-08-16 ]

The version I am using may contain some fixes not yet distributed but I am not sure what they could be. But if yours correctly displays Nchars columns, it probably have the same fixes.

When I tried:

SELECT * FROM ntext WHERE mytext = 'Déjà Noël ?';
SELECT * FROM ntext WHERE myntext = 'Déjà Noël ?';

They both failed with the message:

1296: Got error 174 'ExecuteQuery:
com.microsoft.sqlserver.jdbc.SQLServerException: The data types text and varchar
are incompatible in the equal to operator.' from CONNECT

So I did:

UPDATE ntext SET mynvarchar = 'Bête et méchant' where id = 7;
SELECT * FROM ntext WHERE mynvarchar = 'Bête et méchant';

And it worked and displayed the line 7 (but requires DATA_CHARSET=utf8)

Perhaps is there errors specific to some charsets (like Thai)

Comment by Robert Dyas [ 2017-08-16 ]

Regarding:

When I tried:
SELECT * FROM ntext WHERE mytext = 'Déjà Noël ?';
SELECT * FROM ntext WHERE myntext = 'Déjà Noël ?';
They both failed with the message: com.microsoft.sqlserver.jdbc.SQLServerException: The data types text and varchar are incompatible in the equal to operator.' from CONNECT

That makes sense to me. It is a MS SQL SERVER limitation I'm guessing.

Regarding:

UPDATE ntext SET mynvarchar = 'Bête et méchant' where id = 7;
SELECT * FROM ntext WHERE mynvarchar = 'Bête et méchant';

Funny, that works for me too. Both the UPDATE and the SELECT work correctly. So it must only be an issue with more exotic characters like Thai/Arabic/Kanji?

Generated at Thu Feb 08 08:06:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.