Top Description Fields Constructors Methods
org.hibernate.dialect.function

public Class DB2SubstringFunction

extends StandardSQLFunction
Class Inheritance
Imports
java.util.Arrays, .HashSet, .List, .Set, org.hibernate.type.StandardBasicTypes

When "substring" function is used for DB2, this implementation of StandardSQLFunction will render "substr" or "substring", depending on the last argument being used. If the last argument is a string unit ("CODEUNITS16", "CODEUNITS32", or "OCTETS"), then the function will be rendered as "substring"; otherwise, it will be rendered as "substr".

ANSI SQL-92 standard defines "substring" without string units, which is more similar to DB2's "substr", so it makes sense to use DB2's "substr" function when string units are not provided.

Background: DB2 has both "substr" and "substring", which are different functions that are not interchangeable. Prior to DB2 11.1, DB2's "substring" function requires an argument for string units; without this argument, DB2 throws an exception. DB2's "substr" function throws an exception if string unit is provided as an argument.

Author
Gail Badner

Field Summary

Modifier and TypeField and Description
private static final Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
Inherited from org.hibernate.dialect.function.StandardSQLFunction:
getNamegetReturnTypegetTypehasArgumentshasParenthesesIfNoArgumentsrendertoString

Field Detail

possibleStringUnitsback to summary
private static final Set<String> possibleStringUnits

Constructor Detail

DB2SubstringFunctionback to summary
public DB2SubstringFunction()

Method Detail

getRenderedNameback to summary
protected String getRenderedName(List<E> arguments)

Overrides org.hibernate.dialect.function.StandardSQLFunction.getRenderedName.

Annotations
@Override