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_empty());
  2. +----------------------------------+
  3. | bitmap_to_string(bitmap_empty()) |
  4. +----------------------------------+
  5. | |
  6. +----------------------------------+
  7. mysql> select bitmap_to_string(bitmap_from_string("0, 1, 2"));
  8. +-------------------------------------------------+
  9. | bitmap_to_string(bitmap_from_string('0, 1, 2')) |
  10. +-------------------------------------------------+
  11. | 0,1,2 |
  12. +-------------------------------------------------+
  13. mysql> select bitmap_from_string("-1, 0, 1, 2");
  14. +-----------------------------------+
  15. | bitmap_from_string('-1, 0, 1, 2') |
  16. +-----------------------------------+
  17. | NULL |
  18. +-----------------------------------+
  19. mysql> select bitmap_to_string(bitmap_from_string("0, 1, 18446744073709551615"));
  20. +--------------------------------------------------------------------+
  21. | bitmap_to_string(bitmap_from_string('0, 1, 18446744073709551615')) |
  22. +--------------------------------------------------------------------+
  23. | 0,1,18446744073709551615 |
  24. +--------------------------------------------------------------------+

keywords

  1. BITMAP_FROM_STRING,BITMAP