PreparedStatement pstmt = conn.prepareStatement("CREATE TEMP TABLE cidr_tab (ip1 cidr, ip2 cidr, ip3 cidr)");
pstmt.executeUpdate();
pstmt.close();
pstmt = conn.prepareStatement("insert into cidr_tab values (?,?,?)");
CidrAddr cidr1;
CidrAddr cidr2;
pstmt.setObject(1, cidr1 = new CidrAddr("2001:4f8:3:ba:2e0:81ff:fe22:d1f1"));
pstmt.setObject(2, cidr2 = new CidrAddr("2001:4f8:3:ba::/64"));
pstmt.setObject(3, null, Types.OTHER);
pstmt.executeUpdate();
pstmt.close();
pstmt = conn.prepareStatement("select * from cidr_tab");
ResultSet rs = pstmt.executeQuery();
assertTrue(rs.next());
assertTrue(rs.getObject(1).getClass() == CidrAddr.class);
assertTrue(cidr1.equals(rs.getObject(1)));
assertTrue(rs.getObject(2).getClass() == CidrAddr.class);
assertTrue(cidr2.equals(rs.getObject(2)));
rs.getObject(3);
assertTrue(rs.wasNull());
rs.close();
pstmt.close();
}