Bit And
Definition
The bitAnd method allows you to add the BIT_AND function to the query. The BIT_AND function allows you performs a “bitwise AND” operation on all non-null input values.
There are 2 ways to call this method:
1. Calling from a KColumn or a KTableColumn
The only one method available to use this functionality calling from a KColumn or a KTableColumn is:
bitAnd(): It does not receive any parameters. TheKColumnorKTableColumnthat invokes the method will be the one supplied to theBIT_ANDfunction.
Example
Java code:
k
.select(
APP_USER.ID.bitAnd(),
APP_USER.CREATED_AT.cast(date())
)
.from(APP_USER)
.groupBy(APP_USER.CREATED_AT.cast(date()))
.multiple();
SQL generated:
SELECT
BIT_AND(au.id),
CAST(au.created_at AS DATE)
FROM app_user au
GROUP BY CAST(au.created_at AS DATE)
Parameters:
- None
2. Calling from the KFunction class
The only one method available to use this functionality calling from the KFunction class is:
bitAnd(KColumn kColumn): Receives aKColumnor aKTableColumnwhich will be supplied to theBIT_ANDfunction.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example
Java code:
k
.select(
bitAnd(APP_USER.ID),
APP_USER.CREATED_AT.cast(date())
)
.from(APP_USER)
.groupBy(APP_USER.CREATED_AT.cast(date()))
.multiple();
SQL generated:
SELECT
BIT_AND(au.id),
CAST(au.created_at AS DATE)
FROM app_user au
GROUP BY CAST(au.created_at AS DATE)
Parameters:
- None