in reply to DBIx::Class : match integer-cols having specific bits set

Greetings brother bliako,

Generally, to signify that the RHS in a where subclause is a column identifier, use -ident.

my %where = ( foo => 'bar', baz => { -ident => 'qux' }, );
produces
where foo = "bar" and baz = qux

Also note that you can supply literal SQL using a reference to a string.

Sorry, IDK about your bitwise issue.

See the doc for SQL::Abstract, which DBIx uses behind the scenes.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: DBIx::Class : match integer-cols having specific bits set
by bliako (Abbot) on Sep 29, 2020 at 05:44 UTC

    Brother 1nickt thanks for the hint and the pointers to SQL::Abstract which helped me to put together the literal SQL queries below:

    my %where = ( '(roles &2) => \'(roles &4)', );

    and

    my %where = ( 0 => {'<' => \"(roles & 4)"}, );

    or

    my %where = ( '(roles & 4)' => {'>' => '0'}, );

    bw, bliako