Package com.impossibl.postgres.types.PrimitiveType

Examples of com.impossibl.postgres.types.PrimitiveType.Record


    @Override
    public Object decode(Type type, Short typeLength, Integer typeModifier, ByteBuf buffer, Context context) throws IOException {

      CompositeType compType = (CompositeType) type;

      Record record = null;

      int length = buffer.readInt();

      if (length != -1) {

        long readStart = buffer.readerIndex();

        int itemCount = buffer.readInt();

        Object[] attributeVals = new Object[itemCount];

        for (int c = 0; c < itemCount; ++c) {

          Attribute attribute = compType.getAttribute(c + 1);

          Type attributeType = context.getRegistry().loadType(buffer.readInt());

          if (attributeType.getId() != attribute.type.getId()) {

            context.refreshType(attributeType.getId());
          }

          Object attributeVal = attributeType.getBinaryCodec().decoder.decode(attributeType, null, null, buffer, context);

          attributeVals[c] = attributeVal;
        }

        if (length != buffer.readerIndex() - readStart) {
          throw new IllegalStateException();
        }

        record = new Record(compType, attributeVals);
      }

      return record;
    }
View Full Code Here


      if (val != null) {

        int writeStart = buffer.writerIndex();

        Record record = (Record) val;

        Object[] attributeVals = record.getValues();

        CompositeType compType = (CompositeType) type;

        Collection<Attribute> attributes = compType.getAttributes();
View Full Code Here

      int length = 4;

      if (val != null) {

        Record record = (Record) val;

        Object[] attributeVals = record.getValues();

        CompositeType compType = (CompositeType) type;

        Collection<Attribute> attributes = compType.getAttributes();
View Full Code Here

      if (length != 0) {

        instance = readComposite(buffer, type.getDelimeter(), (CompositeType) type, context);
      }

      return new Record((CompositeType)type, instance);
    }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.types.PrimitiveType.Record

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.