empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivan nemeth <ivan.nem...@forumdigital.net>
Subject Re: Bitwise support
Date Fri, 07 Aug 2015 09:29:19 GMT
Hi Rainer,

great, this is what I need.

Thanks,
Ivan

On Fri, Aug 7, 2015 at 10:37 AM, Rainer Döbele <doebele@esteam.de> wrote:

> Hi Ivan,
>
>
>
> there is currently no bitwise operation built in, but you can easily
> create it yourself.
>
> Just define this function somewhere in your code:
>
>
>
> private DBColumnExpr getBitwiseAndExpr(DBColumnExpr column, int bitmask)
>
> {
>
>     return new DBFuncExpr(column, "? & {0}", new Object[] { new
> Integer(bitmask) }, null, false, DataType.INTEGER);
>
> }
>
>
>
> Then you can easily create your constraint like this:
>
>
>
> cmd.where(getBitwiseAndExpr(MY_COLUMN,  5).is( 5 ));
>
>
>
> This will give you your desired statement.
>
>
>
> Regards,
>
> Rainer
>
>
>
>
>
> *from:* Ivan Nemeth [mailto:ivan.nemeth@gmail.com]
> *to:* user
> *re:* Bitwise support
>
>
>
> Hi,
>
>
>
> is there any bitwise operation support implemented in Empire?
>
>
>
> SELECT *  FROM table WHERE state_col & 5 = 5
>
>
>
> Ivan
>

Mime
View raw message