Package com.impossibl.postgres.api.data

Examples of com.impossibl.postgres.api.data.CidrAddr


    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();
  }
View Full Code Here


          return map;
        }

      } },
      {"inet", new InetAddr("2001:4f8:3:ba:2e0:81ff:fe22:d1f1/10")},
      {"cidr", new CidrAddr("2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128")},
      {"tid", new PGRowId(new Tid(0, (short) 1))},
    };

    List<Object[]> data = new ArrayList<>();
View Full Code Here

  static class CidrObjectFactory implements NetworkObjectFactory<CidrAddr> {

    @Override
    public CidrAddr newNetworkObject(byte[] addr, short netmask) {
      return new CidrAddr(addr, netmask);
    }
View Full Code Here

      return new CidrAddr(addr, netmask);
    }

    @Override
    public CidrAddr newNetworkObject(String v) {
      return new CidrAddr(v);
    }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.api.data.CidrAddr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.