Can user variables be assigned of BIT datatype? Based on the documentation:


  User variables can be assigned a value from a limited set of data types: integer, decimal, floating-point, binary or nonbinary string, or NULL value.


As you see, user variables aren't supported BIT datatype. Right? Ok, I have this code:

BEGIN
    SELECT active INTO @active FROM users WHERE id = new.user_id;
    IF (IFNULL((@active &amp; b'100' &gt; 0), 0) &lt; 1) THEN
        SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = "You cannot vote";
    END IF;
END


Note: active column is BIT(10).

You know, my code surprisingly works as well .. Why? I mean how MySQL treats with @active variable as a BIT datatype?
b'100' is just the number 4 represented in a different way.  Similarly for the column active and the variable @active.