Package com.impossibl.postgres.types.Type

Examples of com.impossibl.postgres.types.Type.Codec


  private Object inOut(Type type, Format format, Object value) throws IOException, SQLException {

    value = coerceValue(type, format, value);

    Codec codec = type.getCodec(format);

    ByteBuf buffer = Unpooled.buffer();
    codec.encoder.encode(type, buffer, value, conn);
    Object res = codec.decoder.decode(type, null, null, buffer, conn);
View Full Code Here


      for (int c = 0; c < vals.length; ++c) {

        Attribute attr = type.getAttribute(c + 1);

        Codec codec = attr.type.getCodec(Format.Text);

        StringBuilder attrOut = new StringBuilder();

        codec.encoder.encode(attr.type, attrOut, vals[c], context);
View Full Code Here

    return DEFAULT_MOD_PARSER;
  }


  public static Codec loadNamedTextCodec(String baseName, Context context) {
    Codec codec = new Codec();
    codec.encoder = loadEncoderProc(baseName + "in",  context, DEFAULT_ENCODERS[Format.Text.ordinal()]);
    codec.decoder = loadDecoderProc(baseName + "out", context, DEFAULT_DECODERS[Format.Text.ordinal()]);
    return codec;
  }
View Full Code Here

    codec.decoder = loadDecoderProc(baseName + "out", context, DEFAULT_DECODERS[Format.Text.ordinal()]);
    return codec;
  }

  public static Codec loadNamedBinaryCodec(String baseName, Context context) {
    Codec codec = new Codec();
    codec.encoder = loadEncoderProc(baseName + "recv", context, DEFAULT_ENCODERS[Format.Binary.ordinal()]);
    codec.decoder = loadDecoderProc(baseName + "send", context, DEFAULT_DECODERS[Format.Binary.ordinal()]);
    return codec;
  }
View Full Code Here

   * @param decoderId proc-id of the decoder
   * @return A matching Codec instance
   */
  public Codec loadCodec(int encoderId, int decoderId, Format format) {

    Codec io = new Codec();
    io.decoder = loadDecoderProc(decoderId, Procs.getDefaultDecoder(format));
    io.encoder = loadEncoderProc(encoderId, Procs.getDefaultEncoder(format));
    return io;
  }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.types.Type.Codec

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.