Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: DBIx::Class : match integer-cols having specific bits set

by 1nickt (Canon)
on Sep 28, 2020 at 19:51 UTC ( [id://11122305]=note: print w/replies, xml ) Need Help??


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 (Monsignor) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found