Skip to content

Commit c826943

Browse files
committed
fixed JDBC test for client info to match by query id
1 parent 47b33cb commit c826943

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,12 @@ public void setAndGetClientInfoTest(String clientName) throws SQLException {
306306

307307
final String testQuery = "SELECT '" + UUID.randomUUID() + "'";
308308
stmt.execute(testQuery);
309+
String queryId = ((StatementImpl)stmt).getLastQueryId();
309310
stmt.execute("SYSTEM FLUSH LOGS");
310311

312+
311313
final String logQuery ="SELECT http_user_agent " +
312-
" FROM clusterAllReplicas('default', system.query_log) WHERE query = '" + testQuery.replaceAll("'", "\\\\'") + "'";
314+
" FROM clusterAllReplicas('default', system.query_log) WHERE query_id = " + stmt.enquoteLiteral(queryId);
313315
try (ResultSet rs = stmt.executeQuery(logQuery)) {
314316
Assert.assertTrue(rs.next());
315317
String userAgent = rs.getString("http_user_agent");

0 commit comments

Comments
 (0)