bitmap_from_string

description

Syntax

BITMAP BITMAP_FROM_STRING(VARCHAR input)

将一个字符串转化为一个BITMAP,字符串是由逗号分隔的一组unsigned bigint数字组成.(数字取值在:0 ~ 18446744073709551615) 比如”0, 1, 2”字符串会转化为一个Bitmap,其中的第0, 1, 2位被设置. 当输入字段不合法时,返回NULL

example

  1. mysql> select bitmap_to_string(bitmap_from_string("0, 1, 2"));
  2. +-------------------------------------------------+
  3. | bitmap_to_string(bitmap_from_string('0, 1, 2')) |
  4. +-------------------------------------------------+
  5. | 0,1,2 |
  6. +-------------------------------------------------+
  7. mysql> select bitmap_from_string("-1, 0, 1, 2");
  8. +-----------------------------------+
  9. | bitmap_from_string('-1, 0, 1, 2') |
  10. +-----------------------------------+
  11. | NULL |
  12. +-----------------------------------+
  13. mysql> select bitmap_to_string(bitmap_from_string("0, 1, 18446744073709551615"));
  14. +--------------------------------------------------------------------+
  15. | bitmap_to_string(bitmap_from_string('0, 1, 18446744073709551615')) |
  16. +--------------------------------------------------------------------+
  17. | 0,1,18446744073709551615 |
  18. +--------------------------------------------------------------------+

keywords

  1. BITMAP_FROM_STRING,BITMAP