From cfc6dae5b230c8d1cfb43c4559b8710ce35c43dd Mon Sep 17 00:00:00 2001 From: Dmitriy Dumanskiy Date: Sun, 1 Sep 2019 14:42:03 +0300 Subject: [PATCH] #30 cleanup --- .../ClickHousePreparedStatementImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java b/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java index 261c76a..ba0b464 100644 --- a/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java +++ b/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java @@ -142,7 +142,7 @@ public int executeUpdate() throws SQLException { } private void setBind(int parameterIndex, String bind, boolean quote) { - binds[parameterIndex - 1] = new ClickHousePreparedStatementParameter(bind, quote); + setBind(parameterIndex, new ClickHousePreparedStatementParameter(bind, quote)); } private void setBind(int parameterIndex, ClickHousePreparedStatementParameter parameter) { @@ -310,16 +310,16 @@ private byte[][] buildBatch() throws SQLException { String[] batchParams = parameterList[i]; int batchParamsLength = batchParams.length; for (int j = 0; j < batchParamsLength; j++) { - String pValue = batchParams[j]; - if (PARAM_MARKER.equals(pValue)) { + String batchVal = batchParams[j]; + if (PARAM_MARKER.equals(batchVal)) { + ClickHousePreparedStatementParameter param = binds[p++]; if (insertBatchMode) { - sb.append(binds[p++].getBatchValue()); + batchVal = param.getBatchValue(); } else { - sb.append(binds[p++].getRegularValue()); + batchVal = param.getRegularValue(); } - } else { - sb.append(pValue); } + sb.append(batchVal); char appendChar = j < batchParamsLength - 1 ? '\t' : '\n'; sb.append(appendChar); }