To set a flag i write SET status=status|?
how do i clear a flag? Usually i write SET status=status&(-1^?)
but ^ is illegal in sqlite. How do i clear a flag or use exclusive or?
views:
92answers:
1
+1
A:
There does not appear to be a xor operator for sqlite. You can simulate it using:
select (~(a&b))&(a|b)
For example, when 1111 (15) is masked with 0100 (4):
select (~(15&4))&(15|4)
the answer is 1011 (11). In that way you can clear flags.
Andomar
2010-02-19 06:17:40
acidzombie24
2010-02-19 08:28:29
Right, that'd be much better. xor is for toggle not clear like you said
Andomar
2010-02-19 08:57:08