Skip to content

Commit 3b6fc1c

Browse files
author
Paultagoras
committed
Adding IPs to the test values
1 parent 0e4ecfc commit 3b6fc1c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import org.testng.Assert;
55
import org.testng.annotations.Test;
66

7+
import java.net.Inet4Address;
8+
import java.net.Inet6Address;
79
import java.sql.Array;
810
import java.sql.Connection;
911
import java.sql.Date;
@@ -428,4 +430,23 @@ public void testWithComments() throws Exception {
428430
assertEquals(StatementImpl.parseStatementType(""), StatementImpl.StatementType.OTHER);
429431
assertEquals(StatementImpl.parseStatementType(" "), StatementImpl.StatementType.OTHER);
430432
}
433+
434+
435+
@Test(groups = { "integration" })
436+
public void testWithIPs() throws Exception {
437+
try (Connection conn = getJdbcConnection()) {
438+
try (Statement stmt = conn.createStatement()) {
439+
try (ResultSet rs = stmt.executeQuery("SELECT toIPv4('127.0.0.1'), toIPv6('::1'), toIPv6('2001:438:ffff::407d:1bc1')")) {
440+
assertTrue(rs.next());
441+
assertEquals(rs.getString(1), "/127.0.0.1");
442+
assertEquals(rs.getObject(1), Inet4Address.getByName("127.0.0.1"));
443+
assertEquals(rs.getString(2), "/0:0:0:0:0:0:0:1");
444+
assertEquals(rs.getObject(2), Inet6Address.getByName("0:0:0:0:0:0:0:1"));
445+
assertEquals(rs.getString(3), "/2001:438:ffff:0:0:0:407d:1bc1");
446+
assertEquals(rs.getObject(3), Inet6Address.getByName("2001:438:ffff:0:0:0:407d:1bc1"));
447+
assertFalse(rs.next());
448+
}
449+
}
450+
}
451+
}
431452
}

0 commit comments

Comments
 (0)