Bit values
Bit values start with the prefix b /B or 0b /0B and consist of binary digits, which are 0 and 1.
The following are valid bit values:
b'11'
B'11'
0b11
0B11
The following are invalid bit values:
b'3' (3 is not a binary digit)
By default, bit values are binary strings:
SELECT b'1000001', CHARSET(b'1000001');
+------------+---------------------+
| b'1000001' | CHARSET(b'1000001') |
+------------+---------------------+
| A | binary |
+------------+---------------------+
1 row in set (0.000 sec)
SELECT 0b1100001, CHARSET(0b1100001);
+-----------+--------------------+
| 0b1100001 | CHARSET(0b1100001) |
+-----------+--------------------+
| a | binary |
+-----------+--------------------+
1 row in set (0.000 sec)
SeekDB treats bit values as integers. To ensure that bit values are not treated as numbers, you can add 0 or use CAST(... AS UNSIGNED). By default, bit values assigned to user-defined variables are binary strings.
SET @v1 = b'1100001';
Query OK, 0 rows affected (0.000 sec)
SET @v2 = b'1100001'+0;
Query OK, 0 rows affected (0.000 sec)
SET @v3 = CAST(b'1100001' AS UNSIGNED);
Query OK, 0 rows affected (0.000 sec)
SELECT @v1, @v2, @v3;
+------+------+------+
| @v1 | @v2 | @v3 |
+------+------+------+
| a | 97 | 97 |
+------+------+------+
1 row in set (0.001 sec)