MySQL Forums
Forum List  »  Connector/ODBC

Re: odbc can not get the whole utf8 string
Posted by: cole lin
Date: February 16, 2022 08:59PM

I think it is not because f2 too small;
varchar(25) means can store 25 character but not 25 byte;

I can operate with:
mysql -h 192.168.26.42 -u root -p

mysql> insert into test_tab values(2, "沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙");
Query OK, 1 row affected (0.02 sec)

mysql> select f2 from test_tab where f1 = 2;
+-----------------------------------------------------------------------------+
| f2 |
+-----------------------------------------------------------------------------+
| 沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙子沙 |
+-----------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select length(f2),char_length(f2) from test_tab where f1 = 2;
+------------+-----------------+
| length(f2) | char_length(f2) |
+------------+-----------------+
| 75 | 25 |
+------------+-----------------+
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Written By
Posted
Re: odbc can not get the whole utf8 string
February 16, 2022 08:59PM


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.