
Just like LENGTH() function, MySQL BIT_LENGTH() function is not a multi-byte safe function. As we know that the difference of the result between multi-byte safe functions, like CHAR_LENGTH() or CHARACTER_LENGTH(), and BIT_LENGTH() function especially relevant for Unicode, in which most of the characters are encoded in two bytes or relevant for UTF-8 where the number of bytes varies. It is demonstrated in the example below −
mysql> Select BIT_LENGTH('tutorialspoint');
+------------------------------+
| BIT_LENGTH('tutorialspoint') |
+------------------------------+
| 112 |
+------------------------------+
1 row in set (0.00 sec)The above result set shows that the bit length of string ‘tutorialspoint’ is 112 because it is yet not converted to Unicode character. The following query converts it into Unicode character −
该版本面向个人用户及小型数字卡销售商开发,具有操作简捷、功能强大等特点,且安全及稳定性突出修正说明:1、纠正了部分页面的翻页错误;2、纠正了后台统计不能清零的错误;3、纠正了后台商品管理修改后出错以及无法彻底删除的错误;4、纠正了注册时不能检测用户名是否存在的错误;5、纠正了用户无法修改密码的错误;6、新增“更多新闻”;7、新增会员登陆验证码;8、去除多余及
0
mysql> SET @A = CONVERT('tutorialspoint' USING ucs2);
Query OK, 0 rows affected (0.02 sec)在将字符串转换为Unicode后,结果为224而不是112,因为在Unicode中,一个字符占用2个字节,如下所示 −
mysql> Select BIT_LENGTH(@A); +----------------+ | BIT_LENGTH(@A) | +----------------+ | 224 | +----------------+ 1 row in set (0.00 sec)
以上就是MySQL BIT_LENGTH() 函数是否是多字节安全的?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号