|
4 | 4 | import org.testng.Assert; |
5 | 5 | import org.testng.annotations.Test; |
6 | 6 |
|
| 7 | +import java.net.Inet4Address; |
| 8 | +import java.net.Inet6Address; |
7 | 9 | import java.sql.Array; |
8 | 10 | import java.sql.Connection; |
9 | 11 | import java.sql.Date; |
@@ -428,4 +430,23 @@ public void testWithComments() throws Exception { |
428 | 430 | assertEquals(StatementImpl.parseStatementType(""), StatementImpl.StatementType.OTHER); |
429 | 431 | assertEquals(StatementImpl.parseStatementType(" "), StatementImpl.StatementType.OTHER); |
430 | 432 | } |
| 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 | + } |
431 | 452 | } |
0 commit comments