diff --git a/clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseSimpleRecordTest.java b/clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseSimpleRecordTest.java
index d25bb9206..7c434f07f 100644
--- a/clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseSimpleRecordTest.java
+++ b/clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseSimpleRecordTest.java
@@ -28,9 +28,9 @@ public void testNullInput() {
public void testMismatchedColumnsAndValues() {
Assert.assertThrows(IllegalArgumentException.class, () -> ClickHouseSimpleRecord
- .of(Map.of("a", 0), new ClickHouseValue[0]));
+ .of(Collections.singletonMap("a", 0), new ClickHouseValue[0]));
- ClickHouseSimpleRecord record = new ClickHouseSimpleRecord(Map.of("a", 0),
+ ClickHouseSimpleRecord record = new ClickHouseSimpleRecord(Collections.singletonMap("a", 0),
new ClickHouseValue[0]);
Assert.assertEquals(record.getValues(), new ClickHouseValue[0]);
}
diff --git a/jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java b/jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java
index 5adab9313..6566f7bb2 100644
--- a/jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java
+++ b/jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java
@@ -403,21 +403,29 @@ public ResultSetMetaData getMetaData() throws SQLException {
private static final Pattern REPLACE_Q_MARK_PATTERN = Pattern.compile("(\"[^\"]*\"|`[^`]*`|'[^']*')|(\\?)");
- public static String replaceQuestionMarks(String sql, String replacement) {
+ public static String replaceQuestionMarks(String sql, final String replacement) {
Matcher matcher = REPLACE_Q_MARK_PATTERN.matcher(sql);
StringBuilder result = new StringBuilder();
+ int lastPos = 0;
while (matcher.find()) {
- if (matcher.group(1) != null) {
+ String text;
+ if ((text = matcher.group(1)) != null) {
// Quoted string — keep as-is
- matcher.appendReplacement(result, Matcher.quoteReplacement(matcher.group(1)));
+ String str = Matcher.quoteReplacement(text);
+ result.append(sql, lastPos, matcher.start()).append(str);
+ lastPos = matcher.end();
} else if (matcher.group(2) != null) {
// Question mark outside quotes — replace it
- matcher.appendReplacement(result, Matcher.quoteReplacement(replacement));
+ String str = Matcher.quoteReplacement(replacement);
+ result.append(sql, lastPos, matcher.start()).append(str);
+ lastPos = matcher.end();
}
}
- matcher.appendTail(result);
+
+ // Add rest of the `sql`
+ result.append(sql, lastPos, sql.length());
return result.toString();
}
diff --git a/jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java b/jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
index ebfe37d50..b6251107f 100644
--- a/jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
+++ b/jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
@@ -1414,9 +1414,4 @@ public long getMaxLogicalLobSize() throws SQLException {
public boolean supportsRefCursors() throws SQLException {
return false;
}
-
- @Override
- public boolean supportsSharding() throws SQLException {
- return false;
- }
}
diff --git a/jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java b/jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java
index 324c57698..7d3e9e26e 100644
--- a/jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java
+++ b/jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java
@@ -1,11 +1,5 @@
package com.clickhouse.jdbc;
-import java.nio.charset.StandardCharsets;
-import java.sql.*;
-import java.util.*;
-
-import java.util.Properties;
-
import com.clickhouse.client.ClickHouseNode;
import com.clickhouse.client.ClickHouseProtocol;
import com.clickhouse.client.ClickHouseServerForTest;
@@ -23,6 +17,20 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import java.nio.charset.StandardCharsets;
+import java.sql.Array;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Properties;
+import java.util.UUID;
+
import static org.testng.Assert.assertThrows;
import static org.testng.Assert.fail;
@@ -347,32 +355,6 @@ public void getNetworkTimeoutTest() throws SQLException {
assertThrows(SQLFeatureNotSupportedException.class, () -> localConnection.getNetworkTimeout());
}
- @Test(groups = { "integration" })
- public void beginRequestTest() throws SQLException {
- Connection localConnection = this.getJdbcConnection();
- localConnection.beginRequest();//No-op
- }
-
- @Test(groups = { "integration" })
- public void endRequestTest() throws SQLException {
- Connection localConnection = this.getJdbcConnection();
- localConnection.endRequest();//No-op
- }
-
- @Test(groups = { "integration" })
- public void setShardingKeyIfValidTest() throws SQLException {
- Connection localConnection = this.getJdbcConnection();
- assertThrows(SQLFeatureNotSupportedException.class, () -> localConnection.setShardingKeyIfValid(null, 0));
- assertThrows(SQLFeatureNotSupportedException.class, () -> localConnection.setShardingKeyIfValid(null, null, 0));
- }
-
- @Test(groups = { "integration" })
- public void setShardingKeyTest() throws SQLException {
- Connection localConnection = this.getJdbcConnection();
- assertThrows(SQLFeatureNotSupportedException.class, () -> localConnection.setShardingKey(null));
- assertThrows(SQLFeatureNotSupportedException.class, () -> localConnection.setShardingKey(null, null));
- }
-
@Test(groups = { "integration" })
public void testMaxResultRowsProperty() throws Exception {
Properties properties = new Properties();
diff --git a/jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java b/jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java
index aa7d81ca2..002fb5fb4 100644
--- a/jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java
+++ b/jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java
@@ -22,7 +22,6 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
diff --git a/pom.xml b/pom.xml
index 96569f5cc..cbf0b9cb5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,8 +120,8 @@
3.1.0
3.6.0
- 3.3.1
- 3.13.0
+ 3.5.0
+ 3.14.0
3.1.1
3.3.0
3.1.0
@@ -131,22 +131,24 @@
3.1.0
3.4.0
0.8.12
- 3.3.0
- 3.5.0
+ 3.4.2
+ 3.11.2
0.9.23
1.7.1
0.6.1
- 3.5.0
- 3.2.1
+ 3.6.0
+ 3.3.1
1.6.13
- 3.2.5
- 3.1.0
- 2.16.0
+ 3.5.3
+ 3.2.0
+ 2.18.0
3.3.1
1.37
33.4.6-jre
- 1.8
+ 17
+ 17
+ 1.8
false
${skipTests}
${skipTests}
@@ -591,10 +593,8 @@
org.apache.maven.plugins
maven-compiler-plugin
- ${minJdk}
- ${minJdk}
- 17
- 17
+ ${minSourceJdk}
+ ${minSourceJdk}
true
-Xlint:all
@@ -812,6 +812,21 @@
j8
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+ 1.8
+
+
+
+
+
2.9.2
@@ -948,7 +963,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- ${minJdk}
+ ${javadoc.source.version}
@@ -1044,8 +1059,8 @@
org.apache.maven.plugins
maven-compiler-plugin
- ${minJdk}
- ${minJdk}
+ 1.8
+ 1.8
true
-Xlint:all
@@ -1179,7 +1194,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- ${minJdk}
+ ${javadoc.source.version}