bit manipulation - How to use binary/bitfield literals in a MySQL statement -


select (bin(~'101010101010101')) result; result : '1111111111111111101001000010000111000000110011111000000101001010' 

is true?

i expect see result:

'1111111111111111111111111111111111111111111111111010101010101010'

help me please.

you passing string bitwise operation. these operations defined bigint integers in mysql, might unexpected results.

you should try:

select bin(~0x5555) result 

or:

select bin(~b'101010101010101' ) result 

results in:

'1111111111111111111111111111111111111111111111111010101010101010' 

Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -