Package org.postgresql.jdbc
Class ArrayDecoding
java.lang.Object
org.postgresql.jdbc.ArrayDecoding
Utility for decoding arrays.
See ArrayEncoding
for description of the binary format of arrays.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static final class
private static interface
private static final class
(package private) static final class
Array list implementation specific for storing PG array elements. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ArrayDecoding.ArrayDecoder<BigDecimal[]>
private static final ArrayDecoding.ArrayDecoder<Boolean[]>
private static final ArrayDecoding.ArrayDecoder<byte[][]>
private static final ArrayDecoding.ArrayDecoder<Date[]>
private static final ArrayDecoding.ArrayDecoder<Double[]>
private static final ArrayDecoding.ArrayDecoder<Float[]>
private static final ArrayDecoding.ArrayDecoder<Long[]>
private static final ArrayDecoding.ArrayDecoder<Integer[]>
private static final ArrayDecoding.ArrayDecoder<Long[]>
private static final Map<Integer,
ArrayDecoding.ArrayDecoder> Maps from base type oid toArrayDecoding.ArrayDecoder
capable of processing entries.private static final ArrayDecoding.ArrayDecoder<Short[]>
private static final ArrayDecoding.ArrayDecoder<String[]>
private static final ArrayDecoding.ArrayDecoder<String[]>
private static final ArrayDecoding.ArrayDecoder<Time[]>
private static final ArrayDecoding.ArrayDecoder<Timestamp[]>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static ArrayDecoding.PgArrayList
buildArrayList
(String fieldString, char delim) Parses the string representation of an array into aArrayDecoding.PgArrayList
.private static <A> ArrayDecoding.ArrayDecoder<A>
getDecoder
(int oid, BaseConnection connection) static Object
readBinaryArray
(int index, int count, byte[] bytes, BaseConnection connection) Reads binary representation of array into object model.static Object
readStringArray
(int index, int count, int oid, ArrayDecoding.PgArrayList list, BaseConnection connection) ReadsString
representation of array into object model.private static <A> void
storeStringValues
(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, List list, int[] dimensionLengths, int dim, BaseConnection connection) private static <A> void
storeValues
(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, ByteBuffer bytes, int skip, int[] dimensionLengths, int dim, BaseConnection connection)
-
Field Details
-
LONG_OBJ_ARRAY
-
INT4_UNSIGNED_OBJ_ARRAY
-
INTEGER_OBJ_ARRAY
-
SHORT_OBJ_ARRAY
-
DOUBLE_OBJ_ARRAY
-
FLOAT_OBJ_ARRAY
-
BOOLEAN_OBJ_ARRAY
-
STRING_ARRAY
-
BYTE_ARRAY_ARRAY
-
BIG_DECIMAL_STRING_DECODER
-
STRING_ONLY_DECODER
-
DATE_DECODER
-
TIME_DECODER
-
TIMESTAMP_DECODER
-
OID_TO_DECODER
Maps from base type oid toArrayDecoding.ArrayDecoder
capable of processing entries.
-
-
Constructor Details
-
ArrayDecoding
ArrayDecoding()
-
-
Method Details
-
getDecoder
private static <A> ArrayDecoding.ArrayDecoder<A> getDecoder(int oid, BaseConnection connection) throws SQLException - Throws:
SQLException
-
readBinaryArray
public static Object readBinaryArray(int index, int count, byte[] bytes, BaseConnection connection) throws SQLException Reads binary representation of array into object model.- Parameters:
index
- 1 based index of where to start on outermost array.count
- The number of items to return from outermost array (beginning at index).bytes
- The binary representation of the array.connection
- The connection the bytes were retrieved from.- Returns:
- The parsed array.
- Throws:
SQLException
- For failures encountered during parsing.
-
storeValues
private static <A> void storeValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, ByteBuffer bytes, int skip, int[] dimensionLengths, int dim, BaseConnection connection) throws SQLException - Throws:
SQLException
-
buildArrayList
Parses the string representation of an array into aArrayDecoding.PgArrayList
.- Parameters:
fieldString
- The array value to parse.delim
- The delimiter character appropriate for the data type.- Returns:
- A
ArrayDecoding.PgArrayList
representing the parsed fieldString.
-
readStringArray
public static Object readStringArray(int index, int count, int oid, ArrayDecoding.PgArrayList list, BaseConnection connection) throws SQLException ReadsString
representation of array into object model.- Parameters:
index
- 1 based index of where to start on outermost array.count
- The number of items to return from outermost array (beginning at index).oid
- The oid of the base type of the array.list
- The#buildArrayList(String, char) processed
string representation of an array.connection
- The connection the bytes were retrieved from.- Returns:
- The parsed array.
- Throws:
SQLException
- For failures encountered during parsing.
-
storeStringValues
private static <A> void storeStringValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, List list, int[] dimensionLengths, int dim, BaseConnection connection) throws SQLException - Throws:
SQLException
-