Package org.h2.expression.function
Class BitFunction
- java.lang.Object
-
- org.h2.expression.Expression
-
- org.h2.expression.Operation1_2
-
- org.h2.expression.function.Function1_2
-
- org.h2.expression.function.BitFunction
-
- All Implemented Interfaces:
NamedExpression
,HasSQL
,Typed
public final class BitFunction extends Function1_2
A bitwise function.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BITAND
BITAND() (non-standard).static int
BITCOUNT
BITCOUNT() (non-standard).static int
BITGET
BITGET() (non-standard).static int
BITNAND
BITNAND() (non-standard).static int
BITNOR
BITNOR() (non-standard).static int
BITNOT
BITNOT() (non-standard).static int
BITOR
BITOR() (non-standard).static int
BITXNOR
BITXNOR() (non-standard).static int
BITXOR
BITXOR() (non-standard).private int
function
static int
LSHIFT
LSHIFT() (non-standard).private static java.lang.String[]
NAMES
static int
ROTATELEFT
ROTATELEFT() (non-standard).static int
ROTATERIGHT
ROTATERIGHT() (non-standard).static int
RSHIFT
RSHIFT() (non-standard).static int
ULSHIFT
ULSHIFT() (non-standard).static int
URSHIFT
URSHIFT() (non-standard).-
Fields inherited from class org.h2.expression.Operation1_2
left, right, type
-
Fields inherited from class org.h2.expression.Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESES
-
Fields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
-
-
Constructor Summary
Constructors Constructor Description BitFunction(Expression arg1, Expression arg2, int function)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static ValueBigint
bitCount(Value v1)
private static ValueBoolean
bitGet(Value v1, Value v2)
static TypeInfo
checkArgType(Expression arg)
private static Value
getBinaryString(int function, TypeInfo type, Value v1, Value v2)
static Value
getBitwise(int function, TypeInfo type, Value v1, Value v2)
Computes the value of bitwise function.private static TypeInfo
getCommonType(Expression arg1, Expression arg2)
java.lang.String
getName()
Get the name.private static Value
getNumeric(int function, TypeInfo type, Value v1, Value v2)
Value
getValue(SessionLocal session, Value v1, Value v2)
Returns the value of this function.Expression
optimize(SessionLocal session)
Try to optimize the expression.private Expression
optimizeNot(SessionLocal session)
private static Value
rotate(Value v1, long offset, boolean right)
private static Value
shift(Value v1, long offset, boolean unsigned)
-
Methods inherited from class org.h2.expression.function.Function1_2
getUnenclosedSQL, getValue
-
Methods inherited from class org.h2.expression.Operation1_2
getCost, getSubexpression, getSubexpressionCount, getType, isEverything, mapColumns, setEvaluatable, updateAggregate
-
Methods inherited from class org.h2.expression.Expression
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, getWhenSQL, getWhenValue, isConstant, isIdentity, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimizeCondition, toString, writeExpressions, writeExpressions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.h2.util.HasSQL
getTraceSQL
-
-
-
-
Field Detail
-
BITAND
public static final int BITAND
BITAND() (non-standard).- See Also:
- Constant Field Values
-
BITOR
public static final int BITOR
BITOR() (non-standard).- See Also:
- Constant Field Values
-
BITXOR
public static final int BITXOR
BITXOR() (non-standard).- See Also:
- Constant Field Values
-
BITNOT
public static final int BITNOT
BITNOT() (non-standard).- See Also:
- Constant Field Values
-
BITNAND
public static final int BITNAND
BITNAND() (non-standard).- See Also:
- Constant Field Values
-
BITNOR
public static final int BITNOR
BITNOR() (non-standard).- See Also:
- Constant Field Values
-
BITXNOR
public static final int BITXNOR
BITXNOR() (non-standard).- See Also:
- Constant Field Values
-
BITGET
public static final int BITGET
BITGET() (non-standard).- See Also:
- Constant Field Values
-
BITCOUNT
public static final int BITCOUNT
BITCOUNT() (non-standard).- See Also:
- Constant Field Values
-
LSHIFT
public static final int LSHIFT
LSHIFT() (non-standard).- See Also:
- Constant Field Values
-
RSHIFT
public static final int RSHIFT
RSHIFT() (non-standard).- See Also:
- Constant Field Values
-
ULSHIFT
public static final int ULSHIFT
ULSHIFT() (non-standard).- See Also:
- Constant Field Values
-
URSHIFT
public static final int URSHIFT
URSHIFT() (non-standard).- See Also:
- Constant Field Values
-
ROTATELEFT
public static final int ROTATELEFT
ROTATELEFT() (non-standard).- See Also:
- Constant Field Values
-
ROTATERIGHT
public static final int ROTATERIGHT
ROTATERIGHT() (non-standard).- See Also:
- Constant Field Values
-
NAMES
private static final java.lang.String[] NAMES
-
function
private final int function
-
-
Constructor Detail
-
BitFunction
public BitFunction(Expression arg1, Expression arg2, int function)
-
-
Method Detail
-
getValue
public Value getValue(SessionLocal session, Value v1, Value v2)
Description copied from class:Function1_2
Returns the value of this function.- Overrides:
getValue
in classFunction1_2
- Parameters:
session
- the sessionv1
- the value of first argumentv2
- the value of second argument, ornull
- Returns:
- the resulting value
-
bitGet
private static ValueBoolean bitGet(Value v1, Value v2)
-
bitCount
private static ValueBigint bitCount(Value v1)
-
getBitwise
public static Value getBitwise(int function, TypeInfo type, Value v1, Value v2)
Computes the value of bitwise function.
-
getBinaryString
private static Value getBinaryString(int function, TypeInfo type, Value v1, Value v2)
-
optimize
public Expression optimize(SessionLocal session)
Description copied from class:Expression
Try to optimize the expression.- Specified by:
optimize
in classExpression
- Parameters:
session
- the session- Returns:
- the optimized expression
-
optimizeNot
private Expression optimizeNot(SessionLocal session)
-
getCommonType
private static TypeInfo getCommonType(Expression arg1, Expression arg2)
-
checkArgType
public static TypeInfo checkArgType(Expression arg)
Checks the type of an argument of bitwise function (one ofBITAND
,BITOR
,BITXOR
,BITNOT
,BITNAND
,BITNOR
,BITXNOR
).- Parameters:
arg
- the argument- Returns:
- the type of the specified argument
- Throws:
DbException
- if argument type is not supported by bitwise functions
-
getName
public java.lang.String getName()
Description copied from interface:NamedExpression
Get the name.- Returns:
- the name in uppercase
-
-