From d0e2266180f6cd73a9a9dd78afff70f2591e968a Mon Sep 17 00:00:00 2001 From: u$f Date: Thu, 12 Sep 2024 18:14:21 +0200 Subject: [PATCH] edit --- .../org/usf/jquery/core/FunctionOperator.java | 2 +- .../org/usf/jquery/core/KeyValueMapper.java | 2 +- .../org/usf/jquery/core/SqlStringBuilder.java | 23 +++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/usf/jquery/core/FunctionOperator.java b/src/main/java/org/usf/jquery/core/FunctionOperator.java index 8d0c823..9f2356e 100644 --- a/src/main/java/org/usf/jquery/core/FunctionOperator.java +++ b/src/main/java/org/usf/jquery/core/FunctionOperator.java @@ -15,6 +15,6 @@ default void sql(SqlStringBuilder sb, QueryContext ctx, Object[] args) { } default void sql(SqlStringBuilder sb, QueryContext ctx, Object[] args, int from) { - sb.function(id(), ()-> ctx.appendLiteralArray(sb, args, from)); //avoid array copy + sb.function(id(), ()-> ctx.appendLiteralArray(sb, args, from)); //avoid sub array } } diff --git a/src/main/java/org/usf/jquery/core/KeyValueMapper.java b/src/main/java/org/usf/jquery/core/KeyValueMapper.java index 8c2980e..ca58988 100644 --- a/src/main/java/org/usf/jquery/core/KeyValueMapper.java +++ b/src/main/java/org/usf/jquery/core/KeyValueMapper.java @@ -33,4 +33,4 @@ public List map(ResultSet rs) throws SQLException { log.trace("{} rows mapped in {} ms", res.size(), currentTimeMillis()-t); return res; } -} +} \ No newline at end of file diff --git a/src/main/java/org/usf/jquery/core/SqlStringBuilder.java b/src/main/java/org/usf/jquery/core/SqlStringBuilder.java index e097e1e..0443120 100644 --- a/src/main/java/org/usf/jquery/core/SqlStringBuilder.java +++ b/src/main/java/org/usf/jquery/core/SqlStringBuilder.java @@ -65,19 +65,22 @@ public SqlStringBuilder runForeach(T[] arr, String delimiter, Consumer fn } public SqlStringBuilder runForeach(T[] arr, int idx, String delimiter, Consumer fn, String prefix, String suffix) { - if(idx < 0 || (isEmpty(arr) && idx > 0) || idx >= requireNonNull(arr, "arr connot be null").length) { - throw new IndexOutOfBoundsException(idx); - } - sb.append(prefix); - if(!isEmpty(arr)) { //idx < arr.length - var i=idx; - fn.accept(arr[i]); - for(++i; i