[jOOQ/jOOQ#18607] Inlining of large SQLDataType.NCLOB values doesn't use TO_NCLOB() in Oracle, like for large CLOB values
This commit is contained in:
parent
695148dfc9
commit
e54f9574b3
@ -1336,6 +1336,33 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
.sql('\'');
|
||||
}
|
||||
|
||||
static final <U> void sqlInlineWorkaround6516(
|
||||
BindingSQLContext<U> ctx,
|
||||
String value,
|
||||
int limit,
|
||||
String prefix,
|
||||
ThrowingBiConsumer<? super BindingSQLContext<U>, ? super String, SQLException> sqlInline0
|
||||
) throws SQLException {
|
||||
int l = value.length();
|
||||
|
||||
if (l > limit) {
|
||||
ctx.render().sql('(');
|
||||
|
||||
for (int i = 0; i < l; i += limit) {
|
||||
if (i > 0)
|
||||
ctx.render().sql(" || ");
|
||||
|
||||
ctx.render().sql(prefix).sql("(");
|
||||
sqlInline0.accept(ctx, value.substring(i, Math.min(l, i + limit)));
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
else
|
||||
sqlInline0.accept(ctx, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
/* non-final */ void sqlBind0(BindingSQLContext<U> ctx, T value) throws SQLException {
|
||||
ctx.render().sql(ctx.variable());
|
||||
@ -5010,7 +5037,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
// future UTF encodings which may use more bytes per
|
||||
// character are not handled here, yet.
|
||||
if (ctx.family() == DERBY)
|
||||
sqlInlineWorkaround6516(ctx, value, 8192, "");
|
||||
sqlInlineWorkaround6516(ctx, value, 8192, "", super::sqlInline0);
|
||||
|
||||
|
||||
|
||||
@ -5026,28 +5053,6 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
super.sqlInline0(ctx, value);
|
||||
}
|
||||
|
||||
private final void sqlInlineWorkaround6516(BindingSQLContext<U> ctx, String value, int limit, String prefix) throws SQLException {
|
||||
int l = value.length();
|
||||
|
||||
if (l > limit) {
|
||||
ctx.render().sql('(');
|
||||
|
||||
for (int i = 0; i < l; i += limit) {
|
||||
if (i > 0)
|
||||
ctx.render().sql(" || ");
|
||||
|
||||
ctx.render().sql(prefix).sql("(");
|
||||
super.sqlInline0(ctx, value.substring(i, Math.min(l, i + limit)));
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
else
|
||||
super.sqlInline0(ctx, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
final void set0(BindingSetStatementContext<U> ctx, String value) throws SQLException {
|
||||
|
||||
@ -5159,6 +5164,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
if (NO_SUPPORT_NVARCHAR.contains(ctx.dialect())) {
|
||||
fallback.sqlInline0(ctx, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else {
|
||||
ctx.render().sql('N');
|
||||
super.sqlInline0(ctx, value);
|
||||
|
||||
@ -40,6 +40,14 @@ interface ThrowingConsumer<T, E extends Throwable> {
|
||||
void accept(T t) throws E;
|
||||
}
|
||||
|
||||
/**
|
||||
* A checked exception throwing {@link BiConsumer}.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
interface ThrowingBiConsumer<T1, T2, E extends Throwable> {
|
||||
void accept(T1 t1, T2 t2) throws E;
|
||||
}
|
||||
|
||||
/**
|
||||
* A checked exception throwing {@link Supplier}.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user