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

public Class AnsiTrimEmulationFunction

extends AbstractAnsiTrimEmulationFunction
Class Inheritance
Imports
org.hibernate.type.StandardBasicTypes

A SQLFunction implementation that emulates the ANSI SQL trim function on dialects which do not support the full definition. However, this function definition does assume the availability of ltrim, rtrim, and replace functions which it uses in various combinations to emulate the desired ANSI trim() functionality.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
BOTH_SPACE_TRIM_FROM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces, with the optional FROM keyword.

public static final String
BOTH_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces

public static final String
BOTH_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from both the beginning and the end of text.

private final SQLFunction
private final SQLFunction
private final SQLFunction
public static final String
LEADING_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming leading spaces

public static final String
LEADING_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from the beginning of text.

private final SQLFunction
private final SQLFunction
public static final String
LTRIM

The default ltrim function name

public static final String
REPLACE

The default replace function name

public static final String
RTRIM

The default rtrim function name

public static final String
SPACE_PLACEHOLDER

The placeholder used to represent whitespace

public static final String
TRAILING_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming trailing spaces

public static final String
TRAILING_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from the end of text.

private final SQLFunction
private final SQLFunction

Constructor Summary

AccessConstructor and Description
public
AnsiTrimEmulationFunction()

Constructs a new AnsiTrimEmulationFunction using LTRIM, RTRIM, and REPLACE respectively.

public
AnsiTrimEmulationFunction(String
The left trim function to use.
ltrimFunctionName
,
String
The right trim function to use.
rtrimFunctionName
,
String
The replace function to use.
replaceFunctionName
)

Constructs a trim() emulation function definition using the specified function calls.

Method Summary

Modifier and TypeMethod and Description
protected SQLFunction
resolveBothSpaceTrimFromFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFromFunction.

Resolve the function definition which should be used to trim both leading and trailing spaces.
protected SQLFunction
resolveBothSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFunction.

Resolve the function definition which should be used to trim both leading and trailing spaces.
protected SQLFunction
resolveBothTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothTrimFunction.

Resolve the function definition which should be used to trim the specified character from both the beginning (leading) and end (trailing) of the trim source.
protected SQLFunction
resolveLeadingSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingSpaceTrimFunction.

Resolve the function definition which should be used to trim leading spaces.
protected SQLFunction
resolveLeadingTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingTrimFunction.

Resolve the function definition which should be used to trim the specified character from the beginning (leading) of the trim source.
protected SQLFunction
resolveTrailingSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingSpaceTrimFunction.

Resolve the function definition which should be used to trim trailing spaces.
protected SQLFunction
resolveTrailingTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingTrimFunction.

Resolve the function definition which should be used to trim the specified character from the end (trailing) of the trim source.
Inherited from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction:
getReturnTypehasArgumentshasParenthesesIfNoArgumentsrender

Field Detail

BOTH_SPACE_TRIM_FROM_TEMPLATEback to summary
public static final String BOTH_SPACE_TRIM_FROM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces, with the optional FROM keyword. Different because we need to skip the FROM keyword in the SQLFunctionTemplate processing

BOTH_SPACE_TRIM_TEMPLATEback to summary
public static final String BOTH_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces

BOTH_TRIM_TEMPLATEback to summary
public static final String BOTH_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from both the beginning and the end of text.

Note

again, we have a series of calls that is essentially the same as outlined in LEADING_TRIM_TEMPLATE except that here we perform both left (leading) and right (trailing) trimming.

bothSpaceTrimback to summary
private final SQLFunction bothSpaceTrim
bothSpaceTrimFromback to summary
private final SQLFunction bothSpaceTrimFrom
bothTrimback to summary
private final SQLFunction bothTrim
LEADING_SPACE_TRIM_TEMPLATEback to summary
public static final String LEADING_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming leading spaces

LEADING_TRIM_TEMPLATEback to summary
public static final String LEADING_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from the beginning of text.

NOTE : essentially we:

  1. replace all space chars with the text '${space}$'
  2. replace all the actual replacement chars with space chars
  3. perform left-trimming (that removes any of the space chars we just added which occur at the beginning of the text)
  4. replace all space chars with the replacement char
  5. replace all the '${space}$' text with space chars
leadingSpaceTrimback to summary
private final SQLFunction leadingSpaceTrim
leadingTrimback to summary
private final SQLFunction leadingTrim
LTRIMback to summary
public static final String LTRIM

The default ltrim function name

REPLACEback to summary
public static final String REPLACE

The default replace function name

RTRIMback to summary
public static final String RTRIM

The default rtrim function name

SPACE_PLACEHOLDERback to summary
public static final String SPACE_PLACEHOLDER

The placeholder used to represent whitespace

TRAILING_SPACE_TRIM_TEMPLATEback to summary
public static final String TRAILING_SPACE_TRIM_TEMPLATE

The SQLFunctionTemplate pattern for the trimming trailing spaces

TRAILING_TRIM_TEMPLATEback to summary
public static final String TRAILING_TRIM_TEMPLATE

A template for the series of calls required to trim non-space chars from the end of text.

Note

essentially the same series of calls as outlined in LEADING_TRIM_TEMPLATE except that here, instead of left-trimming the added spaces, we right-trim them to remove them from the end of the text.

trailingSpaceTrimback to summary
private final SQLFunction trailingSpaceTrim
trailingTrimback to summary
private final SQLFunction trailingTrim

Constructor Detail

AnsiTrimEmulationFunctionback to summary
public AnsiTrimEmulationFunction()

Constructs a new AnsiTrimEmulationFunction using LTRIM, RTRIM, and REPLACE respectively.

See Also
AnsiTrimEmulationFunction(String, String, String)
AnsiTrimEmulationFunctionback to summary
public AnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName)

Constructs a trim() emulation function definition using the specified function calls.

Parameters
ltrimFunctionName:String

The left trim function to use.

rtrimFunctionName:String

The right trim function to use.

replaceFunctionName:String

The replace function to use.

Method Detail

resolveBothSpaceTrimFromFunctionback to summary
protected SQLFunction resolveBothSpaceTrimFromFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFromFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFromFunction.

Resolve the function definition which should be used to trim both leading and trailing spaces.

The same as {#link resolveBothSpaceTrimFunction} except that here theFROM is included and will need to be accounted for during SQLFunction#render processing.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveBothSpaceTrimFunctionback to summary
protected SQLFunction resolveBothSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothSpaceTrimFunction.

Resolve the function definition which should be used to trim both leading and trailing spaces.

In this form, the input arguments is missing the FROM keyword.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveBothTrimFunctionback to summary
protected SQLFunction resolveBothTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveBothTrimFunction.

Resolve the function definition which should be used to trim the specified character from both the beginning (leading) and end (trailing) of the trim source.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveLeadingSpaceTrimFunctionback to summary
protected SQLFunction resolveLeadingSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingSpaceTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingSpaceTrimFunction.

Resolve the function definition which should be used to trim leading spaces.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveLeadingTrimFunctionback to summary
protected SQLFunction resolveLeadingTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveLeadingTrimFunction.

Resolve the function definition which should be used to trim the specified character from the beginning (leading) of the trim source.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveTrailingSpaceTrimFunctionback to summary
protected SQLFunction resolveTrailingSpaceTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingSpaceTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingSpaceTrimFunction.

Resolve the function definition which should be used to trim trailing spaces.

Returns:SQLFunction

The sql function

Annotations
@Override
resolveTrailingTrimFunctionback to summary
protected SQLFunction resolveTrailingTrimFunction()

Implements abstract org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingTrimFunction.

Doc from org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction.resolveTrailingTrimFunction.

Resolve the function definition which should be used to trim the specified character from the end (trailing) of the trim source.

Returns:SQLFunction

The sql function

Annotations
@Override