Class DBCaseMapExpr

All Implemented Interfaces:
ColumnExpr

public class DBCaseMapExpr extends DBCaseExpr
This class is used to create a SQL CASE constraint in the form of case {expr} when {value1} then {result1} when {value2} then {result2} ... else {defaultResult} end"

There is no need to explicitly create instances of this class.
Instead use DBDatabase.caseMap(DBColumnExpr, Object, Object, Object)

Author:
doebele
  • Constructor Details

    • DBCaseMapExpr

      public DBCaseMapExpr(DBColumnExpr caseExpr, Map<? extends Object,? extends Object> valueMap, Object elseValue)
      constructs a DBCaseSelectExpr expr
      Parameters:
      caseExpr - the case expression
      valueMap - the value Map
      elseValue - the else Expression
    • DBCaseMapExpr

      public DBCaseMapExpr(DBColumnExpr caseExpr, Object cmpVal, Object trueValue, Object elseValue)
    • DBCaseMapExpr

      public DBCaseMapExpr(DBColumnExpr caseExpr, Object cmpVal1, Object trueValue1, Object cmpVal2, Object trueValue2, Object elseValue)
  • Method Details

    • getName

      public String getName()
      Description copied from class: DBColumnExpr
      Returns the column name for this column expression. The name must contain only alphanumeric characters and the underscore. For SQL functions this name may be generated. However subsequent calls to this function for the same object instance must return the same string.
      Specified by:
      getName in interface ColumnExpr
      Specified by:
      getName in class DBColumnExpr
      Returns:
      the column name
    • equals

      public boolean equals(Object other)
      Returns true if other is equal to this expression
      Overrides:
      equals in class Object
    • addReferencedColumns

      public void addReferencedColumns(Set<DBColumn> list)
      Description copied from class: DBExpr
      Internal function to obtain all DBColumnExpr-objects used by this expression.
      Specified by:
      addReferencedColumns in class DBExpr
      Parameters:
      list - list to which all used column expressions must be added
    • addSQL

      public void addSQL(DBSQLBuilder sql, long context)
      Description copied from class: DBExpr
      Used to build the SQL command. SQL for this expression must be appended to StringBuilder.
      Specified by:
      addSQL in class DBExpr
      Parameters:
      sql - the string buffer used to build the sql command
      context - context flag for this SQL-Command (see CTX_??? constants).