Codota Logo
Expression.isConstant
Code IndexAdd Codota to your IDE (free)

How to use
isConstant
method
in
org.h2.expression.Expression

Best Java code snippets using org.h2.expression.Expression.isConstant (Showing top 20 results out of 315)

  • Common ways to obtain Expression
private void myMethod () {
Expression e =
  • Codota IconValueExpression.getNull()
  • Codota IconColumn column;column.getDefaultExpression()
  • Codota IconTableFilter tableFilter;tableFilter.getJoinCondition()
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  left = left.optimize(session);
  if (left.isConstant() && left == ValueExpression.getNull()) {
    return left;
  }
  return this;
}
origin: com.h2database/h2

  /**
   * Add an additional element if possible. Example: given two conditions
   * A IN(1, 2) OR A=3, the constant 3 is added: A IN(1, 2, 3).
   *
   * @param session the session
   * @param other the second condition
   * @return null if the condition was not added, or the new condition
   */
  Expression getAdditional(Session session, Comparison other) {
    Expression add = other.getIfEquals(left);
    if (add != null) {
      if (add.isConstant()) {
        valueList.add(add);
        valueSet.add(add.getValue(session).convertTo(left.getType()));
        return this;
      }
    }
    return null;
  }
}
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  boolean allConst = true;
  for (int i = 0; i < list.length; i++) {
    Expression e = list[i].optimize(session);
    if (!e.isConstant()) {
      allConst = false;
    }
    list[i] = e;
  }
  if (allConst) {
    return ValueExpression.get(getValue(session));
  }
  return this;
}
origin: com.h2database/h2

/**
 * Get the column for the given table filter, if the sort column is for this
 * filter.
 *
 * @param index the column index (0, 1,..)
 * @param filter the table filter
 * @return the column, or null
 */
public Column getColumn(int index, TableFilter filter) {
  if (orderList == null) {
    return null;
  }
  SelectOrderBy order = orderList.get(index);
  Expression expr = order.expression;
  if (expr == null) {
    return null;
  }
  expr = expr.getNonAliasExpression();
  if (expr.isConstant()) {
    return null;
  }
  if (!(expr instanceof ExpressionColumn)) {
    return null;
  }
  ExpressionColumn exprCol = (ExpressionColumn) expr;
  if (exprCol.getTableFilter() != filter) {
    return null;
  }
  return exprCol.getColumn();
}
origin: com.h2database/h2

boolean lc = left.isConstant();
boolean rc = right.isConstant();
boolean l2c = other.left.isConstant();
boolean r2c = other.right.isConstant();
String l = left.getSQL();
String l2 = other.left.getSQL();
origin: com.h2database/h2

/**
 * Set the on update expression.
 *
 * @param session the session
 * @param onUpdateExpression the on update expression
 */
public void setOnUpdateExpression(Session session, Expression onUpdateExpression) {
  // also to test that no column names are used
  if (onUpdateExpression != null) {
    onUpdateExpression = onUpdateExpression.optimize(session);
    if (onUpdateExpression.isConstant()) {
      onUpdateExpression = ValueExpression.get(onUpdateExpression.getValue(session));
    }
  }
  this.onUpdateExpression = onUpdateExpression;
}
origin: com.h2database/h2

/**
 * Set the default expression.
 *
 * @param session the session
 * @param defaultExpression the default expression
 */
public void setDefaultExpression(Session session,
    Expression defaultExpression) {
  // also to test that no column names are used
  if (defaultExpression != null) {
    defaultExpression = defaultExpression.optimize(session);
    if (defaultExpression.isConstant()) {
      defaultExpression = ValueExpression.get(
          defaultExpression.getValue(session));
    }
  }
  this.defaultExpression = defaultExpression;
}
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  boolean allConst = isDeterministic();
  for (int i = 0, len = args.length; i < len; i++) {
    Expression e = args[i].optimize(session);
    args[i] = e;
    allConst &= e.isConstant();
  }
  if (allConst) {
    return ValueExpression.get(getValue(session));
  }
  return this;
}
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  left = left.optimize(session);
  boolean constant = left.isConstant();
  if (constant && left == ValueExpression.getNull()) {
    return left;
    Expression e = valueList.get(i);
    e = e.optimize(session);
    if (e.isConstant() && e.getValue(session) != ValueNull.INSTANCE) {
      allValuesNull = false;
    if (allValuesConstant && !e.isConstant()) {
      allValuesConstant = false;
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  Expression e2 = condition.getNotIfPossible(session);
  if (e2 != null) {
    return e2.optimize(session);
  }
  Expression expr = condition.optimize(session);
  if (expr.isConstant()) {
    Value v = expr.getValue(session);
    if (v == ValueNull.INSTANCE) {
      return ValueExpression.getNull();
    }
    return ValueExpression.get(v.convertTo(Value.BOOLEAN).negate());
  }
  condition = expr;
  return this;
}
origin: com.h2database/h2

right = right.optimize(session);
if (right instanceof ExpressionColumn) {
  if (left.isConstant() || left instanceof Parameter) {
    Expression temp = left;
    left = right;
  if (right.isConstant()) {
    Value r = right.getValue(session);
    if (r == ValueNull.INSTANCE) {
if (left.isConstant()) {
  return ValueExpression.get(getValue(session));
if (left.isConstant() && right.isConstant()) {
  return ValueExpression.get(getValue(session));
origin: com.h2database/h2

if (expr.isConstant()) {
  continue;
origin: com.h2database/h2

if (!e.isConstant()) {
  allConst = false;
p = args[0].getPrecision();
s = 0;
if (args[1].isConstant()) {
if (args.length == 3 && args[2].isConstant()) {
origin: com.h2database/h2

Value l = left.isConstant() ? left.getValue(session) : null;
Value r = right.isConstant() ? right.getValue(session) : null;
if (l == null && r == null) {
  return this;
origin: com.h2database/h2

  right = right.optimize(session);
  dataType = Value.STRING;
  if (left.isConstant() && right.isConstant()) {
    return ValueExpression.get(getValue(session));
  DbException.throwInternalError("type=" + opType);
if (left.isConstant() && (right == null || right.isConstant())) {
  return ValueExpression.get(getValue(session));
origin: apache/ignite

if (!col.getDefaultExpression().isConstant()) {
  throw new IgniteSQLException("Non-constant DEFAULT expressions are not supported [colName=" + col.getName() + ']',
    IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
origin: com.h2database/com.springsource.org.h2

public void setDefaultExpression(Session session, Expression defaultExpression) throws SQLException {
  // also to test that no column names are used
  if (defaultExpression != null) {
    defaultExpression = defaultExpression.optimize(session);
    if (defaultExpression.isConstant()) {
      defaultExpression = ValueExpression.get(defaultExpression.getValue(session));
    }
  }
  this.defaultExpression = defaultExpression;
}
origin: com.h2database/com.springsource.org.h2

public Expression optimize(Session session) throws SQLException {
  boolean allConst = true;
  for (int i = 0; i < list.length; i++) {
    Expression e = list[i].optimize(session);
    if (!e.isConstant()) {
      allConst = false;
    }
    list[i] = e;
  }
  if (allConst) {
    return ValueExpression.get(getValue(session));
  }
  return this;
}
origin: org.wowtools/h2

@Override
public Expression optimize(Session session) {
  boolean allConst = isDeterministic();
  for (int i = 0, len = args.length; i < len; i++) {
    Expression e = args[i].optimize(session);
    args[i] = e;
    allConst &= e.isConstant();
  }
  if (allConst) {
    return ValueExpression.get(getValue(session));
  }
  return this;
}
origin: com.eventsourcing/h2

@Override
public Expression optimize(Session session) {
  boolean allConst = isDeterministic();
  for (int i = 0, len = args.length; i < len; i++) {
    Expression e = args[i].optimize(session);
    args[i] = e;
    allConst &= e.isConstant();
  }
  if (allConst) {
    return ValueExpression.get(getValue(session));
  }
  return this;
}
org.h2.expressionExpressionisConstant

Javadoc

Check if this expression will always return the same value.

Popular methods of Expression

  • getAlias
    Get the alias name of a column or SQL expression if it is not an aliased expression.
  • getDisplaySize
    Get the display size of this expression.
  • getNonAliasExpression
    Returns the main expression, skipping aliases.
  • getNotIfPossible
    If it is possible, return the negated expression. This is used to optimize NOT expressions: NOT ID>1
  • getPrecision
    Get the precision of this expression.
  • getScale
    Get the scale of this expression.
  • getType
    Return the data type. The data type may not be known before the optimization phase.
  • getValue
    Return the resulting value for the current row.
  • addFilterConditions
    Add conditions to a table filter if they can be evaluated.
  • createIndexConditions
    Create index conditions if possible and attach them to the table filter.
  • getBooleanValue
    Get the value in form of a boolean expression. Returns true or false. In this database, everything c
  • getColumnName
    Get the column name or alias name of this expression.
  • getBooleanValue,
  • getColumnName,
  • getCost,
  • getNullable,
  • getSQL,
  • getSchemaName,
  • getTableAlias,
  • getTableName,
  • isAutoIncrement

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • Kernel (java.awt.image)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Reference (javax.naming)
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now