On Mon Oct 13, 2014 at 02:39:40PM +0100, Paul Sanderson wrote:
> 
> The query is on a visits table from a google chrome history database. The
> query seems to work OK if a single bit is set, but fails (a blank string is
> returned) when multiple bits are set. Any ideas why?

I suspect it is a bug with multiple bitwise ORs. Demonstration:

    WITH x
    AS (
        SELECT
            0x00800000 | 0x08000000 AS a
    )
    SELECT
        a & 0x00800000,
        a & 0x08000000,
        a & 0x00800000 & 0x08000000
    FROM
        x
    ;

Result:

    a & 0x00800000  a & 0x08000000  a & 0x00800000 & 0x08000000
    --------------  --------------  ---------------------------
    8388608         134217728       0                          

Perl equivalent:

    use feature 'say';
    my $a = 0x00800000 | 0x08000000;

    say $a & 0x00800000;
    say $a & 0x08000000;
    say $a & 0x08000000 & 0x08000000;

Result:

    8388608
    134217728
    134217728

-- 
Mark Lawrence
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to