tags:

views:

92

answers:

1

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?

+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
acidzombie24
Right, that'd be much better. xor is for toggle not clear like you said
Andomar