SQLite, Exclusive Or. How to clear the flag?

To set a flag, I write SET status=status|?, how can I remove a flag? I usually write SET status=status&(-1^?), but ^ is illegal in sqlite. How to clear the flag or use exclusive or?

+5
source share
1 answer

There is no xor operator for sqlite. You can simulate it using:

select (~(a&b))&(a|b)

For example, when 1111 (15) is masked 0100 (4):

select (~(15&4))&(15|4)

Answer 1011 (11). This way you can clear the flags.

+7
source

All Articles