Package org.hibernate.dialect.function
Class AnsiTrimEmulationFunction
java.lang.Object
org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction
org.hibernate.dialect.function.AnsiTrimEmulationFunction
- All Implemented Interfaces:
SQLFunction
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final StringA template for the series of calls required to trim non-space chars from both the beginning and the end of text.static final Stringstatic final StringA template for the series of calls required to trim non-space chars from the beginning of text.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringA template for the series of calls required to trim non-space chars from the end of text. -
Constructor Summary
ConstructorsConstructorDescriptionAnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName) Constructs a trim() emulation function definition using the specified function calls. -
Method Summary
Modifier and TypeMethodDescriptionprotected SQLFunctionResolve the function definition which should be used to trim both leading and trailing spaces.protected SQLFunctionResolve the function definition which should be used to trim both leading and trailing spaces.protected SQLFunctionResolve 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 SQLFunctionResolve the function definition which should be used to trim leading spaces.protected SQLFunctionResolve the function definition which should be used to trim the specified character from the beginning (leading) of the trim source.protected SQLFunctionResolve the function definition which should be used to trim trailing spaces.protected SQLFunctionResolve the function definition which should be used to trim the specified character from the end (trailing) of the trim source.Methods inherited from class org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction
getReturnType, hasArguments, hasParenthesesIfNoArguments, render
-
Field Details
-
LTRIM
- See Also:
-
RTRIM
- See Also:
-
REPLACE
- See Also:
-
SPACE_PLACEHOLDER
- See Also:
-
LEADING_SPACE_TRIM_TEMPLATE
- See Also:
-
TRAILING_SPACE_TRIM_TEMPLATE
- See Also:
-
BOTH_SPACE_TRIM_TEMPLATE
- See Also:
-
BOTH_SPACE_TRIM_FROM_TEMPLATE
- See Also:
-
LEADING_TRIM_TEMPLATE
A template for the series of calls required to trim non-space chars from the beginning of text. NOTE : essentially we:- replace all space chars with the text '${space}$'
- replace all the actual replacement chars with space chars
- perform left-trimming (that removes any of the space chars we just added which occur at the beginning of the text)
- replace all space chars with the replacement char
- replace all the '${space}$' text with space chars
- See Also:
-
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 inLEADING_TRIM_TEMPLATEexcept that here, instead of left-trimming the added spaces, we right-trim them to remove them from the end of the text.- See Also:
-
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 inLEADING_TRIM_TEMPLATEexcept that here we perform both left (leading) and right (trailing) trimming.- See Also:
-
-
Constructor Details
-
AnsiTrimEmulationFunction
public AnsiTrimEmulationFunction()- See Also:
-
AnsiTrimEmulationFunction
public AnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName) Constructs a trim() emulation function definition using the specified function calls.- Parameters:
ltrimFunctionName- The left trim function to use.rtrimFunctionName- The right trim function to use.replaceFunctionName- The replace function to use.
-
-
Method Details
-
resolveBothSpaceTrimFunction
Resolve the function definition which should be used to trim both leading and trailing spaces. In this form, the imput arguments is missing the FROM keyword.- Specified by:
resolveBothSpaceTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
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 duringSQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.SessionFactoryImplementor)processing.- Specified by:
resolveBothSpaceTrimFromFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
resolveLeadingSpaceTrimFunction
Resolve the function definition which should be used to trim leading spaces.- Specified by:
resolveLeadingSpaceTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
resolveTrailingSpaceTrimFunction
Resolve the function definition which should be used to trim trailing spaces.- Specified by:
resolveTrailingSpaceTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
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.- Specified by:
resolveBothTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
resolveLeadingTrimFunction
Resolve the function definition which should be used to trim the specified character from the beginning (leading) of the trim source.- Specified by:
resolveLeadingTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-
resolveTrailingTrimFunction
Resolve the function definition which should be used to trim the specified character from the end (trailing) of the trim source.- Specified by:
resolveTrailingTrimFunctionin classAbstractAnsiTrimEmulationFunction- Returns:
- The sql function
-