Package com.impossibl.postgres.types

Examples of com.impossibl.postgres.types.ArrayType


          break;
        case Polygon:
          targetType = double[][].class;
          break;
        case Array:
          ArrayType arrayType = (ArrayType) sourceType;
          targetType = Array.newInstance(mapGetType(format, arrayType.getElementType(), typeMap, context), 0).getClass();
          break;
        default:
          break;
      }
View Full Code Here


      Object instance = null;

      if (length != -1) {

        ArrayType atype = ((ArrayType)type);

        //
        //Header
        //

        int dimensionCount = buffer.readInt();
        /* boolean hasNulls = */ buffer.readInt() /* == 1 ? true : false */;
        Type elementType = context.getRegistry().loadType(buffer.readInt());

        //Each Dimension
        int[] dimensions = new int[dimensionCount];
        int[] lowerBounds = new int[dimensionCount];
        for (int d = 0; d < dimensionCount; ++d) {

          //Dimension
          dimensions[d] = buffer.readInt();

          //Lower bounds
          lowerBounds[d] = buffer.readInt();
        }

        if (atype.getElementType().getId() != elementType.getId()) {
          context.refreshType(atype.getId());
        }

        //
        //Array & Elements
        //
View Full Code Here

      if (val != null) {

        int writeStart = buffer.writerIndex();

        ArrayType atype = ((ArrayType)type);
        Type elementType = atype.getElementType();

        //
        //Header
        //

        int dimensionCount = getDimensions(val.getClass(), atype.unwrapAll());
        //Dimension count
        buffer.writeInt(dimensionCount);
        //Has nulls
        buffer.writeInt(hasNulls(val) ? 1 : 0);
        //Element type
View Full Code Here

      int length = 4;

      if (val != null) {

        ArrayType arrayType = (ArrayType) type;
        Type elementType = arrayType.unwrapAll();

        int dimensionCount = getDimensions(val.getClass(), arrayType.unwrapAll());

        length += 12 + (dimensionCount * 8);

        length += subLength(elementType, dimensionCount, val, context);

View Full Code Here

      Object instance = null;

      if (length != 0) {

        ArrayType atype = ((ArrayType)type);

        instance = readArray(buffer, atype.getDelimeter(), type.unwrap(), context);
      }

      return instance;
    }
View Full Code Here

    }

    @Override
    public void encode(Type type, StringBuilder buffer, Object val, Context context) throws IOException {

      ArrayType arrayType = (ArrayType) type;

      Type elementType = arrayType.getElementType();

      writeArray(buffer, elementType.getDelimeter(), elementType, val, context);

    }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.types.ArrayType

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.