Class DBColumnExpr

All Implemented Interfaces:
ColumnExpr
Direct Known Subclasses:
DBAbstractFuncExpr, DBAliasExpr, DBCalcExpr, DBCaseExpr, DBCmdResultExpr, DBColumn, DBConcatExpr, DBCountExpr, DBParenthesisExpr, DBScalarExpr, DBValueExpr, DBVarArgsFuncExpr, OracleRowNumExpr, PostgresBoolAndOrExpr, PostgresIntervalExpr

public abstract class DBColumnExpr extends DBExpr implements ColumnExpr
This class is the base class for all expressions that represent a single value. It provides a set of factory functions for SQL functions.
  • Field Details

    • attributes

      protected Attributes attributes
    • options

      protected Options options
    • beanPropertyName

      protected String beanPropertyName
  • Constructor Details

    • DBColumnExpr

      public DBColumnExpr()
  • Method Details

    • getDataType

      public abstract DataType getDataType()
      Returns the data type of this column expression.
      Specified by:
      getDataType in interface ColumnExpr
      Returns:
      the expressions data type
      See Also:
    • getName

      public abstract String getName()
      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
      Returns:
      the column name
    • getRowSet

      public abstract DBRowSet getRowSet()
      Returns the underlying rowset containing this column For functions involving none or more than one physical column this function return the first one
      Returns:
      a column used for this expression
    • getUpdateColumn

      public abstract DBColumn getUpdateColumn()
      Returns the underlying physical column. For functions involving none or more than one physical column this function returns null.
      Specified by:
      getUpdateColumn in interface ColumnExpr
      Returns:
      the underlying column
    • getSourceColumn

      @Deprecated public final DBColumn getSourceColumn()
      Deprecated.
      Use getUpdateColumn() instead!
      Specified by:
      getSourceColumn in interface ColumnExpr
    • isAggregate

      public abstract boolean isAggregate()
      Indicates whether this function is an aggregate (sum, min, max, avg, ...) or not
      Returns:
      true if the column expression represents an aggregate
    • addXml

      public abstract Element addXml(Element parent, long flags)
      Add a description of this column with relevant metadata to the supplied parent XML Element.
      Parameters:
      parent - the parent element to which to append the column description
      flags - currently not used
      Returns:
      the newly created child element
    • qualified

      public DBAliasExpr qualified()
      returns an expression that renames the column with its alias name
      Returns:
      the rename expression
    • getAttribute

      public Object getAttribute(String name)
      Returns the value of a column attribute. Column attributes are used to provide metadata for a column.
      Specified by:
      getAttribute in interface ColumnExpr
      Parameters:
      name - the attribute name
      Returns:
      value of the attribute if it exists or null otherwise
    • getAttribute

      public <T> T getAttribute(String name, Class<T> type)
      Returns the value of a column attribute and converts it to the desired type
      Parameters:
      name - the attribute name
      type - the desired Java type
      Returns:
      value of the attribute
    • setAttribute

      public <T extends ColumnExpr> T setAttribute(String name, Object value)
      Sets the value of a column attribute. Same as Column.setAttribute but with different name to avoid name clash
      Specified by:
      setAttribute in interface ColumnExpr
      Type Parameters:
      T - the column expression type
      Parameters:
      name - the attribute name
      value - the value of the attribute
      Returns:
      returns self (this)
    • getOptions

      public Options getOptions()
      Returns the list of options for this column containing all possible field values.
      Specified by:
      getOptions in interface ColumnExpr
      Returns:
      the list of options
    • setOptions

      public <T extends DBColumnExpr> T setOptions(Options options)
      Sets the options for this column indicating all valid values.
      Type Parameters:
      T - the column expression type
      Parameters:
      options - the list of options
      Returns:
      returns self (this)
    • getTitle

      public final String getTitle()
      Returns the title attribute.
      Specified by:
      getTitle in interface ColumnExpr
      Returns:
      the column title
    • setTitle

      public <T extends DBColumnExpr> T setTitle(String title)
      Sets the title attribute.
      Type Parameters:
      T - the column expression type
      Parameters:
      title - the column title
      Returns:
      returns self (this)
    • getControlType

      public final String getControlType()
      Returns the column control type. The control type is a client specific name for the type of input control that should be used to display and edit values for this column.
      Specified by:
      getControlType in interface ColumnExpr
      Returns:
      the column control type
    • setControlType

      public final <T extends DBColumnExpr> T setControlType(String controlType)
      Sets the controlType attribute.
      Type Parameters:
      T - the column expression type
      Parameters:
      controlType - the column control type
      Returns:
      returns self (this)
    • getBeanPropertyName

      public String getBeanPropertyName()
      Gets the Java bean property name for this column i.e. ID = employeeId DATE_OF_BIRTH = dateOfBirth
      Specified by:
      getBeanPropertyName in interface ColumnExpr
      Returns:
      the name of the bean property used to get and set values
    • setBeanPropertyName

      public <T extends DBColumnExpr> T setBeanPropertyName(String propertyName)
      Sets the Java bean property name for this column.
      Type Parameters:
      T - the column expression type
      Parameters:
      propertyName - the property name
      Returns:
      returns self (this)
    • getDefaultSortOrder

      public boolean getDefaultSortOrder()
      Returns the default sort order FALSE is for ascending, TRUE for descending
      Returns:
      true if the default sort order is descending
    • setDefaultSortOrder

      public <T extends DBColumnExpr> T setDefaultSortOrder(Boolean descending)
      Sets the default sort order
      Parameters:
      descending - true if the default sort order is ascending or false if descending
      Returns:
      returns self (this)
    • isCaseSensitive

      public boolean isCaseSensitive()
      Returns whether or not a columnExpr is case sensitive If not explicitly set, the case sensitivity is true for all text fields (VARCHAR, CLOB) except if an EnumType is set.
      Returns:
      true if the columnExpr is case sensitive or false if not
    • getIgnoreCaseExpr

      public DBColumnExpr getIgnoreCaseExpr()
      Returns an expression which ignores the case Only for case sensitive columns! Default is upper(expr)
      Returns:
      the ignore case expression or the expression itself
    • getNumberType

      public String getNumberType(ColumnExpr columnExpr)
      Returns the number type assigned to this column expression
      Parameters:
      columnExpr - the columnExpr
      Returns:
      the number type
    • as

      public DBAliasExpr as(String alias)
      creates a new DBAliasExpr which renames the current expression to the supplied name.

      Parameters:
      alias - the alias name
      Returns:
      the new DBAliasExpr object
    • as

      public final DBAliasExpr as(DBColumn column)
      creates a new DBAliasExpr which renames the current expression to the name of the supplied column.

      Parameters:
      column - the column whose name serves as an alias for the current expression
      Returns:
      the new DBAliasExpr object
    • cmp

      public DBCompareColExpr cmp(DBCmpType op, Object value)
      Creates and returns a new comparison object for the given comparison operator and value.
      Parameters:
      op - the comparison operator
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • like

      public final DBCompareColExpr like(Object value)
      Creates and returns a new comparison object for the SQL "like" operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • likeUpper

      public DBCompareColExpr likeUpper(String value)
      Creates and returns a new case insensitive comparison for the SQL "like" operator. Case insensitivity is achieved by calling getIgnoreCaseExpr() Hence the case insensitive operation is determined by the DBMSHandler Default is upper(value)
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • likeLower

      @Deprecated public DBCompareColExpr likeLower(String value)
      Deprecated.
      Always user likeUpper() for case insensitive comparisons
      Creates and returns a new comparison object for the SQL "like" operator. Converts the column value and comparison value to lower case
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • like

      public DBCompareColExpr like(String value, char escape)
      Creates and returns a new comparison object for the SQL "like" operator.
      Parameters:
      value - the Object value
      escape - the escape character
      Returns:
      the new DBCompareColExpr object
    • notLike

      public final DBCompareColExpr notLike(Object value)
      Creates and returns a new comparison object for the SQL "not like" operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • contains

      public final DBCompareColExpr contains(Object value)
      Creates and returns a new comparison object for the "contains(column, val)" comparator
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • notContains

      public final DBCompareColExpr notContains(Object value)
      Creates and returns a new comparison object for the "not contains(column, val)" comparator
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • is

      public final DBCompareColExpr is(Object value)
      Creates and returns a new comparison object for the SQL "=" (equal) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • isNot

      public final DBCompareColExpr isNot(Object value)
      Creates and returns a new comparison object for the SQL "<>" (not equal) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • in

      public final DBCompareColExpr in(Collection<?> values)
      Creates and returns an expression for the SQL "in" operator.
      Parameters:
      values - the values to compare this column with
      Returns:
      a DBCompareColExpr for the "in" operator
    • in

      @SafeVarargs public final <T> DBCompareColExpr in(T... values)
      Creates and returns an expression for the SQL "in" operator.
      Type Parameters:
      T - the value type
      Parameters:
      values - the values to compare this column with
      Returns:
      a DBCompareColExpr for the "in" operator
    • in

      public final DBCompareColExpr in(DBExpr expr)
      Creates and returns an expression for the SQL "not in" operator.
      Parameters:
      expr - a database expression to provide a list of values
      Returns:
      a DBCompareColExpr for the "not in" operator
    • notIn

      public final DBCompareColExpr notIn(Collection<?> values)
      Creates and returns an expression for the SQL "not in" operator.
      Parameters:
      values - the values to compare this column with
      Returns:
      a DBCompareColExpr for the "not in" operator
    • notIn

      @SafeVarargs public final <T> DBCompareColExpr notIn(T... values)
      Creates and returns an expression for the SQL "not in" operator.
      Type Parameters:
      T - the value type
      Parameters:
      values - the values to compare this column with
      Returns:
      a DBCompareColExpr for the "not in" operator
    • notIn

      public final DBCompareColExpr notIn(DBExpr expr)
      Creates and returns an expression for the SQL "not in" operator.
      Parameters:
      expr - a database expression to provide a list of values
      Returns:
      a DBCompareColExpr for the "not in" operator
    • isBetween

      public final DBCompareColExpr isBetween(Object minValue, Object maxValue)
      Creates and returns a new comparison object for the SQL "between" operator.
      Parameters:
      minValue - the minimum value
      maxValue - the maximum value
      Returns:
      the new DBCompareColExpr object
    • isNotBetween

      public final DBCompareColExpr isNotBetween(Object minValue, Object maxValue)
      Creates and returns a new comparison object for the SQL "not between" operator.
      Parameters:
      minValue - the minimum value
      maxValue - the maximum value
      Returns:
      the new DBCompareColExpr object
    • isGreaterThan

      public final DBCompareColExpr isGreaterThan(Object value)
      Creates and returns a new comparison object for the SQL ">" (greater than) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • isMoreOrEqual

      public final DBCompareColExpr isMoreOrEqual(Object value)
      Creates and returns a new comparison object for the SQL ">=" (greater or equal) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • isLessOrEqual

      public final DBCompareColExpr isLessOrEqual(Object value)
      Creates and returns a new comparison object for the SQL "<=" (less or equal) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • isSmallerThan

      public final DBCompareColExpr isSmallerThan(Object value)
      Creates and returns a new comparison object for the SQL "<" (less than) operator.
      Parameters:
      value - the Object value
      Returns:
      the new DBCompareColExpr object
    • multiplyWith

      public DBCalcExpr multiplyWith(Object value)
      Creates and returns a new calculation object for the SQL "*" (multiply) operator.
      Parameters:
      value - the multiply value
      Returns:
      the new DBCalcExpr object
    • divideBy

      public DBCalcExpr divideBy(Object value)
      Creates and returns a new calculation object for the SQL "/" (divide) operator.
      Parameters:
      value - the divide value
      Returns:
      the new DBCalcExpr object
    • plus

      public DBCalcExpr plus(Object value)
      Creates and returns a new calculation object for the SQL "+" (plus) operator.
      Parameters:
      value - the summate value
      Returns:
      the new DBCalcExpr object
    • minus

      public DBCalcExpr minus(Object value)
      Creates and returns a new calculation object for the SQL "-" (minus) operator.
      Parameters:
      value - the subtract value
      Returns:
      the new DBCalcExpr object
    • plus

      public DBCalcExpr plus(int value)
      Creates and returns a new calculation object for either the SQL "+" (plus) or "-" (minus) operator depending on whether the supplied integer value is positive or negative.
      Parameters:
      value - the subtract value
      Returns:
      the new DBCalcExpr object
    • minus

      public DBCalcExpr minus(int value)
      Creates and returns a new calculation object for either the SQL "+" (plus) or "-" (minus) operator depending on whether the supplied integer value is negative or positive.
      Parameters:
      value - the subtract value
      Returns:
      the new DBCalcExpr object
    • append

      public DBConcatExpr append(Object value)
      Creates a new DBConcatExpr object with the specified value.
      Parameters:
      value - an Object value
      Returns:
      the new DBConcatExpr object
    • getExprFromPhrase

      protected DBFuncExpr getExprFromPhrase(DBSqlPhrase phrase, Object[] params, DataType dataType)
      Creates a new DBFuncExpr from a given SQL-PRHASE and optional additional parameters.
      Parameters:
      phrase - the id of the SQL-phrase
      params - the params to replace in the template
      dataType - the resulting data Type
      Returns:
      the new DBCalcExpr object
    • getExprFromPhrase

      protected final DBFuncExpr getExprFromPhrase(DBSqlPhrase phrase, Object[] params)
    • parenthesis

      public DBColumnExpr parenthesis()
      Creates and returns a function object which encloses the current expression in parenthesis.
      Returns:
      the new DBFuncExpr object
    • coalesce

      public DBCoalesceExpr coalesce(Object nullValue)
      Creates a sql-expression for the nvl() or coalesce() function.
      Parameters:
      nullValue - the alternative value when this expression is null
      Returns:
      the coalesce expression
    • modulo

      public final DBFuncExpr modulo(Object divisor)
      Creates a sql-expression for the modulo or mod() function.
      Parameters:
      divisor - the Object value
      Returns:
      the new DBFuncExpr object
    • nvl

      @Deprecated public DBColumnExpr nvl(Object nullValue)
      Deprecated.
      Outdated oracle syntax - use coalesce instead
      Creates a sql-expression for the nvl() or coalesce() function.
      Parameters:
      nullValue - the int value
      Returns:
      the new DBFuncExpr object
    • substring

      public final DBFuncExpr substring(DBExpr pos)
      Creates and returns a sql-expression for the substring(...) function.
      Parameters:
      pos - the position number of the string
      Returns:
      the new DBFuncExpr object
    • substring

      public DBFuncExpr substring(int pos)
      Overloaded. @see substring(DBExpr pos)
      Parameters:
      pos - the position number of the string
      Returns:
      the new DBFuncExpr object
    • substring

      public final DBFuncExpr substring(DBExpr pos, DBExpr count)
      Creates and returns a sql-expression for the substring(...) function.
      Parameters:
      pos - the position number of the string
      count - the length of the substring
      Returns:
      the new DBFuncExpr object
    • substring

      public DBFuncExpr substring(DBExpr pos, int count)
      Overloaded. @see substring(DBExpr pos, DBExpr count)
      Parameters:
      pos - the position number of the string
      count - the length of the substring
      Returns:
      the new DBFuncExpr object
    • substring

      public DBFuncExpr substring(int pos, DBExpr count)
      Overloaded. @see substring(DBExpr pos, DBExpr count)
      Parameters:
      pos - the position number of the string
      count - the length of the substring
      Returns:
      the new DBFuncExpr object
    • substring

      public DBFuncExpr substring(int pos, int count)
      Overloaded. @see substring(DBExpr pos, DBExpr count)
      Parameters:
      pos - the position number of the string
      count - the length of the substring
      Returns:
      the new DBFuncExpr object
    • replace

      public final DBFuncExpr replace(Object match, Object replace)
      Creates and returns a sql-expression for the replace(...) function.
      Parameters:
      match - string to replace
      replace - string with replacement
      Returns:
      the new DBFuncExpr object
    • reverse

      public final DBFuncExpr reverse()
      Creates and returns a sql-expression for the reverse(...) function.
      Returns:
      the new DBFuncExpr object
    • trim

      public final DBFuncExpr trim()
      Creates and returns a sql-expression for the trim() function.
      Returns:
      the new DBFuncExpr object
    • trimLeft

      public final DBFuncExpr trimLeft()
      Creates and returns a sql-expression for the ltrim() function.
      Returns:
      the new DBFuncExpr object
    • trimRight

      public final DBFuncExpr trimRight()
      Creates and returns a sql-expression for the rtrim() function.
      Returns:
      the new DBFuncExpr object
    • upper

      public final DBFuncExpr upper()
      Creates and returns a function object which converts the current expression to upper case.
      Returns:
      the new DBFuncExpr object
    • lower

      public final DBFuncExpr lower()
      Creates and returns a function object which converts the current expression to lower case.
      Returns:
      the new DBFuncExpr object
    • format

      public final DBFuncExpr format(String format)
      Formats a column-expression using a format string This function is intended for formatting numbers. Formatting any other data types may not supported and be database specific
      Parameters:
      format - the format string. Beware: This is passed to the database "as is" and hence may be database specific.
      Returns:
      a string expression representing the formatted value
    • length

      public final DBFuncExpr length()
      Creates and returns a sql-expression that returns the string length of this expression.
      Returns:
      the new DBFuncExpr object
    • indexOf

      public final DBFuncExpr indexOf(Object str)
      Creates and returns a sql-expression that returns the position of a string in the current column expression.
      Parameters:
      str - the string to find the position of
      Returns:
      the new DBFuncExpr object
    • indexOf

      public final DBFuncExpr indexOf(Object str, DBExpr fromPos)
      Creates and returns a sql-expression that returns the position of a string in the current column expression.
      Parameters:
      str - the string to find the position of
      fromPos - the start position for the search
      Returns:
      the new DBFuncExpr object
    • indexOf

      public final DBFuncExpr indexOf(Object str, int fromPos)
      Overloaded. @see indexOf(Object str, DBExpr fromPos)
      Parameters:
      str - the string to find the position of
      fromPos - the start position for the search
      Returns:
      the new DBFuncExpr object
    • concat

      public DBConcatFuncExpr concat(DBColumnExpr... concatExprs)
      concatenates a list of expressions to the current column
      Parameters:
      concatExprs - the expressions to concat
      Returns:
      the concat expression
    • concat

      public DBConcatFuncExpr concat(String separator, DBColumnExpr... concatExprs)
      concatenates a list of expressions to the current column
      Parameters:
      separator - a string to insert between each of the expressions
      concatExprs - the expressions to concat
      Returns:
      the concat expression
    • prepend

      public DBFuncExpr prepend(Object value)
      Puts a value or expression before the current expression
      Parameters:
      value - the expressions to prepend
      Returns:
      the combined value
    • abs

      public final DBFuncExpr abs()
      Creates and returns a sql-expression for the absolute abs() function.
      Returns:
      the new DBFuncExpr object
    • floor

      public final DBFuncExpr floor()
      Create and returns an expression for the SQL-function floor()
      Returns:
      the new DBFuncExpr object
    • ceiling

      public final DBFuncExpr ceiling()
      Create and returns an expression for the SQL-function ceil()
      Returns:
      the new DBFuncExpr object
    • round

      public final DBFuncExpr round(int decimals)
      Creates and returns an function object that rounds a number espression with the given decimals.
      Parameters:
      decimals - the number of decimal to which to truncate the current value
      Returns:
      the new DBFuncExpr object
    • trunc

      public final DBFuncExpr trunc(int decimals)
      Creates and returns an function object that truncates a number espression with the given decimals.
      Parameters:
      decimals - the number of decimal to which to truncate the current value
      Returns:
      the new DBFuncExpr object
    • year

      public final DBFuncExpr year()
      Creates and returns an function object that calculates the year of a date value.
      Returns:
      the new DBColumnExpr object
    • month

      public final DBFuncExpr month()
      Creates and returns an function object that calculates the month of a date value.
      Returns:
      the new DBColumnExpr object
    • day

      public final DBFuncExpr day()
      Creates and returns an function object that calculates the day of a date value.
      Returns:
      the new DBColumnExpr object
    • sum

      public final DBFuncExpr sum()
      Creates and returns an aggregation function object which calculates the sum for the current expression over a group of rows.
      Returns:
      the new DBFuncExpr object
    • min

      public final DBFuncExpr min()
      Creates and returns an aggregation function object which returns the minimum value for the current expression over a group of rows.
      Returns:
      the new DBFuncExpr object
    • max

      public final DBFuncExpr max()
      Creates and returns an aggregation function object which returns the maximum value for the current expression over a group of rows.
      Returns:
      the new DBFuncExpr object
    • avg

      public final DBFuncExpr avg()
      Creates and returns an aggregation function object which returns the average value for the current expression over a group of rows.
      Returns:
      the new DBFuncExpr object
    • stringAgg

      public final DBFuncExpr stringAgg(String separator, DBOrderByExpr orderBy)
      Creates and returns string aggregation expression
      Parameters:
      separator - the separator between string
      orderBy - the order by expression
      Returns:
      the new DBFuncExpr object
    • stringAgg

      public final DBFuncExpr stringAgg(String separator)
      Creates and returns string aggregation expression
      Parameters:
      separator - the separator between string
      Returns:
      the new DBFuncExpr object
    • count

      public DBCountExpr count()
      Creates and returns an expression for the SQL "count()" function which returns the number of rows in the result set.
      Returns:
      the new DBFuncExpr object
    • countDistinct

      public DBCountExpr countDistinct()
      Creates and returns an expression for the SQL "count()" function which returns the number of unique values in the result set.
      Returns:
      the new DBFuncExpr object
    • decodeEnum

      public DBDecodeExpr decodeEnum(Class<? extends Enum<?>> enumType, String otherwise)
      Creates and returns a sql-expression that maps enum values by name or ordinal to their string representation
      Parameters:
      enumType - an enumType to decode
      otherwise - the varchar value to take if no key matches the given expression
      Returns:
      a DBDecodeExpr object
    • decodeSort

      public DBDecodeExpr decodeSort(Class<? extends Enum<?>> enumType, boolean defaultToEnd)
      Creates and returns a sql-expression that maps enum values from name to ordinal This is useful for sorting. e.g. cmd.orderBy(SOME_EXPR.decodeSort(MyEnum.class, true)
      Parameters:
      enumType - an enumType to decode
      defaultToEnd - true if non matching values (e.g. NULL) should be assigned the highest number, otherwise they get the lowest number
      Returns:
      a DBDecodeExpr object
    • decode

      public DBDecodeExpr decode(Map<?,?> valueMap, Object otherwise)
      Creates and returns a sql-expression that compares the current column expression with a list of values and returns the corresponding alternative value.
      Parameters:
      valueMap - a list of key values pairs used for decoding
      otherwise - the value to take if no key matches the given expression
      Returns:
      a DBDecodeExpr object
    • decode

      public final DBDecodeExpr decode(Object key1, Object value1, Object otherwise)
    • decode

      public final DBDecodeExpr decode(Object key1, Object value1, Object key2, Object value2, Object otherwise)
    • decode

      public final DBDecodeExpr decode(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object otherwise)
    • decode

      public final DBDecodeExpr decode(Options options, Object otherwise)
    • decode

      public final DBDecodeExpr decode(Options options)
    • when

      public final DBCaseExpr when(DBCompareExpr compExpr, Object otherwise)
      Creates and returns a sql-expression for the SQL case-phrase.
      The result will be in the form:
      "case when [compExpr] then [this] else [otherwise] end"
      Parameters:
      compExpr - the condition for which the current column expression is returned
      otherwise - the value that is returned if the condition is false
      Returns:
      a DBCaseExpr representing the SQL case phrase.
    • convertTo

      public DBConvertExpr convertTo(DataType dataType, Object format)
      Creates a new DBFuncExpr object that will convert the current column to the destination data type specified.
      Parameters:
      dataType - the destination data type
      format - optional destination format (usually a string)
      Returns:
      the new DBFuncExpr object
    • convertTo

      public final DBConvertExpr convertTo(DataType dataType)
      Creates and returns a new DBFuncExpr object that will convert the current column to the destination data type specified.
      Parameters:
      dataType - Data type to which to convert the current expression to.
      Returns:
      the new DBFuncExpr object
    • toChar

      public final DBConvertExpr toChar()
      Creates a new DBFuncExpr object (to_char SQL statement) with the parameters prefix = "to_char(" and postfix = ")"
      Returns:
      the new DBFuncExpr object
    • toChar

      public final DBConvertExpr toChar(String format)
      Creates a new DBFuncExpr object (to_char SQL statement) with the parameters prefix = "to_char(" and postfix = ", * '"+format+"')"
      Parameters:
      format - the string value
      Returns:
      the new DBFuncExpr object
    • function

      public final DBColumnExpr function(String template, DataType returnType, Object... params)
      Creates and returns a function from an sql template The template may consist of the following placeholders: ? = the expression on which the function is applied (usually a column expression) {[param-index]:[DataType]} = a function parameter. The DataType name, if supplied, must match the name of a DataType enum value.
      Parameters:
      template - the sql phrase template (see above)
      returnType - the returned DataType
      params - the list of function parameter values
      Returns:
      the function expression
    • aggregate

      public final DBColumnExpr aggregate(String template, DataType returnType, Object... params)
      Creates and returns a function from an sql template The template may consist of the following placeholders: ? = the expression on which the function is applied (usually a column expression) {[param-index]:[DataType]} = a function parameter. The DataType name, if supplied, must match the name of a DataType enum value.
      Parameters:
      template - the sql phrase template (see above)
      returnType - the returned DataType
      params - additional function parameters
      Returns:
      the aggregate expression
    • asc

      public DBOrderByExpr asc()
      creates a new DBOrderByExpr for ascending order

      Returns:
      the new DBOrderByExpr object for ascending order
    • desc

      public DBOrderByExpr desc()
      creates a new DBOrderByExpr for descending order

      Returns:
      the new DBOrderByExpr object for descending order
    • on

      public DBColumnJoinExpr on(DBColumnExpr joinWith)
      create a join expression for DBCommand.join()
      Parameters:
      joinWith - the column expression to join this expression with
      Returns:
      the join expression
    • getJavaType

      public Class<?> getJavaType()
      returns a corresponding Java type for this expression
      Returns:
      the java type
    • toString

      public String toString()
      For Debugging
      Overrides:
      toString in class Object
    • isLiteralValue

      protected boolean isLiteralValue(Object value)
      Checks if a value is a literal value
      Parameters:
      value - the value to check
      Returns:
      true if the value is a simple value like String, Number, Boolean etc.