[jOOQ/jOOQ#10153] Add support for HANA array bind variables
This commit is contained in:
parent
8a0766e888
commit
f6c5ed5461
@ -39,6 +39,7 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.FIELD;
|
||||
import static org.jooq.Clause.FIELD_VALUE;
|
||||
// ...
|
||||
import static org.jooq.conf.ParamType.INDEXED;
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.conf.ParamType.NAMED;
|
||||
@ -158,10 +159,15 @@ abstract class AbstractParam<T> extends AbstractField<T> implements Param<T> {
|
||||
return inline;
|
||||
}
|
||||
|
||||
final boolean isInline(Context<?> context) {
|
||||
final boolean isInline(Context<?> ctx) {
|
||||
return isInline()
|
||||
|| (context.paramType() == INLINED)
|
||||
|| (context.paramType() == NAMED_OR_INLINED && StringUtils.isBlank(paramName));
|
||||
|| (ctx.paramType() == INLINED)
|
||||
|| (ctx.paramType() == NAMED_OR_INLINED && StringUtils.isBlank(paramName))
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
@ -89,14 +90,17 @@ final class Array<T> extends AbstractField<T[]> {
|
||||
|
||||
|
||||
|
||||
|
||||
case H2:
|
||||
case HSQLDB:
|
||||
case POSTGRES:
|
||||
default:
|
||||
boolean squareBrackets = true;
|
||||
|
||||
ctx.visit(K_ARRAY)
|
||||
.sql('[')
|
||||
.sql(squareBrackets ? '[' : '(')
|
||||
.visit(fields)
|
||||
.sql(']');
|
||||
.sql(squareBrackets ? ']' : ')');
|
||||
|
||||
if (fields.fields.length == 0 && REQUIRES_CAST.contains(ctx.family()))
|
||||
ctx.sql("::").visit(K_INT).sql("[]");
|
||||
|
||||
@ -125,6 +125,9 @@ final class ArrayDataType<T> extends DefaultDataType<T[]> {
|
||||
|
||||
private static String getArrayType(Configuration configuration, String dataType) {
|
||||
switch (configuration.family()) {
|
||||
|
||||
|
||||
|
||||
case HSQLDB:
|
||||
return dataType + " array";
|
||||
|
||||
|
||||
@ -1033,8 +1033,10 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// By default, render HSQLDB syntax
|
||||
else {
|
||||
boolean squareBrackets = true;
|
||||
|
||||
ctx.render().visit(K_ARRAY);
|
||||
ctx.render().sql('[');
|
||||
ctx.render().sql(squareBrackets ? '[' : '(');
|
||||
|
||||
for (Object o : value) {
|
||||
ctx.render().sql(separator);
|
||||
@ -1042,7 +1044,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
separator = ", ";
|
||||
}
|
||||
|
||||
ctx.render().sql(']');
|
||||
ctx.render().sql(squareBrackets ? ']' : ')');
|
||||
|
||||
// [#3214] Some PostgreSQL array type literals need explicit casting
|
||||
// TODO: This seems mutually exclusive with the previous branch. Still needed?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user