This last spec is to deal with a limitation on DB2 and variants (e.g. Derby) where dynamic parameters cannot be used in concatenation unless they are being concatenated with at least one non-dynamic operand. And even then, the rules are so convoluted as to what is allowed and when the CAST is needed and when it is not that we just go ahead and do the CASTing.
| Modifier and Type | Class and Description |
|---|---|
| private static interface | |
| private static interface |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Type | getReturnType(Type
The type of the first argument argumentType, Mapping The mapping source. mapping)Implements org. |
| public boolean | hasArguments()
Implements org. |
| public boolean | hasParenthesesIfNoArguments()
Implements org. |
| private static String | join(Iterator<E> elements, DerbyConcatFunction.
|
| public String | render(Type
The type of the first argument argumentType, List<E> The function arguments args, SessionFactoryImplementor The SessionFactory factory)Implements org. |
| DerbyConcatFunction | back to summary |
|---|---|
| public DerbyConcatFunction() | |
| getReturnType | back to summary |
|---|---|
| public Type getReturnType(Type argumentType, Mapping mapping) throws QueryException Implements org. Doc from org. The return type of the function. May be either a concrete type which is preset, or variable depending upon the type of the first function argument.
Note, the 'firstArgumentType' parameter should match the one passed into
Here we always return
| |
| hasArguments | back to summary |
|---|---|
| public boolean hasArguments() Implements org. Doc from org. Does this function have any arguments? Here we always return true
| |
| hasParenthesesIfNoArguments | back to summary |
|---|---|
| public boolean hasParenthesesIfNoArguments() Implements org. Doc from org. If there are no arguments, are parentheses required? Here we always return true
| |
| join | back to summary |
|---|---|
| private static String join(Iterator<E> elements, DerbyConcatFunction. | |
| render | back to summary |
|---|---|
| public String render(Type argumentType, List<E> args, SessionFactoryImplementor factory) throws QueryException Implements org. Doc from org. Render the function call as SQL fragment.
Note, the 'firstArgumentType' parameter should match the one passed into Here's the meat.. The whole reason we have a separate impl for this for Derby is to re-define this method. The logic here says that if not all the incoming args are dynamic parameters (i.e. ?) then we simply use the Derby concat operator (||) on the unchanged arg elements. However, if all the args are dynamic parameters, then we need to wrap the individual arg elements in cast function calls, use the concatenation operator on the cast returns, and then wrap that whole thing in a call to the Derby varchar function.
| |
| getBeginning | back to summary |
|---|---|
| public String getBeginning() Getter for property 'beginning'.
| |
| getEnding | back to summary |
|---|---|
| public String getEnding() Getter for property 'ending'.
| |
| getSeparator | back to summary |
|---|---|
| public String getSeparator() Getter for property 'separator'.
| |
| transform | back to summary |
|---|---|
| public String transform(String string) | |