public class AnsiTrimEmulationFunction extends AbstractAnsiTrimEmulationFunction
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.Modifier and Type | Field and Description |
---|---|
static String |
BOTH_SPACE_TRIM_FROM_TEMPLATE
The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces, with the optional FROM keyword.
|
static String |
BOTH_SPACE_TRIM_TEMPLATE
The SQLFunctionTemplate pattern for the trimming both leading and trailing spaces
|
static 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.
|
static String |
LEADING_SPACE_TRIM_TEMPLATE
The SQLFunctionTemplate pattern for the trimming leading spaces
|
static String |
LEADING_TRIM_TEMPLATE
A template for the series of calls required to trim non-space chars from the beginning of text.
|
static String |
LTRIM
The default
ltrim function name |
static String |
REPLACE
The default
replace function name |
static String |
RTRIM
The default
rtrim function name |
static String |
SPACE_PLACEHOLDER
The placeholder used to represent whitespace
|
static String |
TRAILING_SPACE_TRIM_TEMPLATE
The SQLFunctionTemplate pattern for the trimming trailing spaces
|
static String |
TRAILING_TRIM_TEMPLATE
A template for the series of calls required to trim non-space chars from the end of text.
|
Constructor and Description |
---|
AnsiTrimEmulationFunction()
|
AnsiTrimEmulationFunction(String ltrimFunctionName,
String rtrimFunctionName,
String replaceFunctionName)
Constructs a trim() emulation function definition using the specified function calls.
|
Modifier and Type | Method and Description |
---|---|
protected SQLFunction |
resolveBothSpaceTrimFromFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces.
|
protected SQLFunction |
resolveBothSpaceTrimFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces.
|
protected SQLFunction |
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()
Resolve the function definition which should be used to trim leading spaces.
|
protected SQLFunction |
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()
Resolve the function definition which should be used to trim trailing spaces.
|
protected SQLFunction |
resolveTrailingTrimFunction()
Resolve the function definition which should be used to trim the specified character from the
end (trailing) of the trim source.
|
getReturnType, hasArguments, hasParenthesesIfNoArguments, render
public static final String LTRIM
ltrim
function namepublic static final String RTRIM
rtrim
function namepublic static final String REPLACE
replace
function namepublic static final String SPACE_PLACEHOLDER
public static final String LEADING_SPACE_TRIM_TEMPLATE
public static final String TRAILING_SPACE_TRIM_TEMPLATE
public static final String BOTH_SPACE_TRIM_TEMPLATE
public static final String BOTH_SPACE_TRIM_FROM_TEMPLATE
public static final String LEADING_TRIM_TEMPLATE
public static final String TRAILING_TRIM_TEMPLATE
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.public static final String BOTH_TRIM_TEMPLATE
LEADING_TRIM_TEMPLATE
except that here we perform both left (leading) and right (trailing) trimming.public AnsiTrimEmulationFunction()
public AnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName)
ltrimFunctionName
- The left trim function to use.rtrimFunctionName
- The right trim function to use.replaceFunctionName
- The replace function to use.protected SQLFunction resolveBothSpaceTrimFunction()
resolveBothSpaceTrimFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveBothSpaceTrimFromFunction()
SQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)
processing.resolveBothSpaceTrimFromFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveLeadingSpaceTrimFunction()
resolveLeadingSpaceTrimFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveTrailingSpaceTrimFunction()
resolveTrailingSpaceTrimFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveBothTrimFunction()
resolveBothTrimFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveLeadingTrimFunction()
resolveLeadingTrimFunction
in class AbstractAnsiTrimEmulationFunction
protected SQLFunction resolveTrailingTrimFunction()
resolveTrailingTrimFunction
in class AbstractAnsiTrimEmulationFunction
Copyright © 2020 JBoss by Red Hat. All rights reserved.