MySQLã®varchar(XX)ã¯ãæåæ°(MySQL4.1.20)
ãã£ã±ãã(ç¬)
ã¨ãããã¨ã§å®é¨çµæã¯ãããªã«ã³ã¸ã
TABLE `test1` UTF8
mysql> SHOW FIELDS FROM test1; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | name | varchar(32) | | | | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) mysql> INSERT INTO test1 SET name = '12345678901234567890123456789012'; Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO test1 SET name = '123456789012345678901234567890123'; Query OK, 1 row affected, 1 warning (0.01 sec) mysql> INSERT INTO test1 SET name = 'ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼'; Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO test1 SET name = 'ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼'; Query OK, 1 row affected, 1 warning (0.00 sec) mysql> SELECT * FROM test1; +----+--------------------------------------------------------------------------------------------------+ | id | name | +----+--------------------------------------------------------------------------------------------------+ | 7 | 12345678901234567890123456789012 | | 8 | 12345678901234567890123456789012 | | 9 | ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ | | 10 | ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ | +----+--------------------------------------------------------------------------------------------------+ 4 rows in set (0.00 sec)
ãã«ããã¤ããASCIIãã32æåã ãå ¥ã£ã¦ã¾ããï¼ããããå¤ãæåãå ¥ãããã¨ããã¨ããå°»ã§åãããããã¦ãINSERTæã«warningãåºã¾ãããï¼
ç§ã¯ã©ã¡ããã¨ããã¨ãã¤ãæ°ã§è¨ç®ããã»ããâ¦ã ã£ã¦ããã¤ãæ°ã®ãªããASCIIã§ããã«ããã¤ãã§ãã大ããã¯çµ¶å¯¾ã§ãããï¼
ã¨ããªãã¨ãèãã¦ãããããããã«ããã¤ãã§ã¯è¡¨ç¾ã§ããéãæ¸ããããªããã¨ãããã¤ãã§ã¡ããåã£ããæå¾ã®æåãåããå¯è½æ§ããããããªããã¨ãè²ã èãã¦ããã