ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/expression/ValueExpression.java

Path
ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/expression/ValueExpression.java
Status
scanned
Type
file
Name
ValueExpression.java
Extension
.java
Programming language
Java
Mime type
text/x-java
File type
Java source, ASCII text
Tag

      
    
Rootfs path

      
    
Size
3919 (3.8 KB)
MD5
ad0d065a2fc72832ac4639d03de107cb
SHA1
062e22d612ed576baaae29ca08cb34f4462cad2a
SHA256
4d49d3dffae93346de6eee55b22cfe9efa6491560478541be25d128fd4ef5ccd
SHA512

      
    
SHA1_git
84aa1226e4f8861ada8597eb6cd6ececbaebd4b1
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ValueExpression.java | 3.8 KB |

/* * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.expression; import org.h2.engine.SessionLocal; import org.h2.expression.condition.Comparison; import org.h2.index.IndexCondition; import org.h2.table.TableFilter; import org.h2.value.TypeInfo; import org.h2.value.Value; import org.h2.value.ValueBoolean; import org.h2.value.ValueNull; /** * An expression representing a constant value. */ public class ValueExpression extends Operation0 { /** * The expression represents ValueNull.INSTANCE. */ public static final ValueExpression NULL = new ValueExpression(ValueNull.INSTANCE); /** * This special expression represents the default value. It is used for * UPDATE statements of the form SET COLUMN = DEFAULT. The value is * ValueNull.INSTANCE, but should never be accessed. */ public static final ValueExpression DEFAULT = new ValueExpression(ValueNull.INSTANCE); /** * The expression represents ValueBoolean.TRUE. */ public static final ValueExpression TRUE = new ValueExpression(ValueBoolean.TRUE); /** * The expression represents ValueBoolean.FALSE. */ public static final ValueExpression FALSE = new ValueExpression(ValueBoolean.FALSE); /** * The value. */ final Value value; ValueExpression(Value value) { this.value = value; } /** * Create a new expression with the given value. * * @param value the value * @return the expression */ public static ValueExpression get(Value value) { if (value == ValueNull.INSTANCE) { return NULL; } if (value.getValueType() == Value.BOOLEAN) { return getBoolean(value.getBoolean()); } return new ValueExpression(value); } /** * Create a new expression with the given boolean value. * * @param value the boolean value * @return the expression */ public static ValueExpression getBoolean(Value value) { if (value == ValueNull.INSTANCE) { return TypedValueExpression.UNKNOWN; } return getBoolean(value.getBoolean()); } /** * Create a new expression with the given boolean value. * * @param value the boolean value * @return the expression */ public static ValueExpression getBoolean(boolean value) { return value ? TRUE : FALSE; } @Override public Value getValue(SessionLocal session) { return value; } @Override public TypeInfo getType() { return value.getType(); } @Override public void createIndexConditions(SessionLocal session, TableFilter filter) { if (value.getValueType() == Value.BOOLEAN && !value.getBoolean()) { filter.addIndexCondition(IndexCondition.get(Comparison.FALSE, null, this)); } } @Override public Expression getNotIfPossible(SessionLocal session) { if (value == ValueNull.INSTANCE) { return TypedValueExpression.UNKNOWN; } return getBoolean(!value.getBoolean()); } @Override public boolean isConstant() { return true; } @Override public boolean isNullConstant() { return this == NULL; } @Override public boolean isValueSet() { return true; } @Override public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags) { if (this == DEFAULT) { builder.append("DEFAULT"); } else { value.getSQL(builder, sqlFlags); } return builder; } @Override public boolean isEverything(ExpressionVisitor visitor) { return true; } @Override public int getCost() { return 0; } }
Detected license expression
mpl-2.0 AND epl-1.0
Detected license expression (SPDX)
MPL-2.0 AND EPL-1.0
Percentage of license text
2.45
Copyrights
- end_line: 2
  copyright: Copyright 2004-2023 H2 Group. Multiple-Licensed
  start_line: 2
Holders
- holder: H2 Group. Multiple-Licensed
  end_line: 2
  start_line: 2
Authors

      
    
License detections License expression License expression SPDX
mpl_2_0_and_epl_1_0-796bf8d7-f485-3520-923d-e6a4b1ecd2f3 mpl-2.0 AND epl-1.0 MPL-2.0 AND EPL-1.0
URL Start line End line
https://h2database.com/html/license.html 3 3
Package URL License Primary language
pkg:osgi/com.h2database.source@2.2.220