Class DBCaseWhenExpr

All Implemented Interfaces:
ColumnExpr

public class DBCaseWhenExpr extends DBCaseExpr
This class is used to create a SQL CASE constraint in the form of case when {cond1} then {result1} when {cond2} then {result2} ... else {defaultResult} end" There is no need to explicitly create instances of this class.
Author:
doebele
  • Constructor Details

    • DBCaseWhenExpr

      public DBCaseWhenExpr(DBDatabase db, Map<DBCompareExpr,? extends Object> whenMap, Object elseValue)
      Constructs a DBCaseExpr
      Parameters:
      db - the database
      whenMap - a map of compareExpressions with the corresponding result values
      elseValue - the expression returned if no condition is true (may be null)
    • DBCaseWhenExpr

      public DBCaseWhenExpr(DBCompareExpr cmpExpr, Object trueExpr, 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).