Package org.postgresql.jdbc
Class PgArray
java.lang.Object
org.postgresql.jdbc.PgArray
- All Implemented Interfaces:
Array
Array is used collect one column of query result data.
Read a field of type Array into either a natively-typed Java array object or a ResultSet. Accessor methods provide the ability to capture array slices.
Other than the constructor all methods are direct implementations of those specified for java.sql.Array. Please refer to the javadoc for java.sql.Array for detailed descriptions of the functionality and parameters of the methods of this class.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected @Nullable org.postgresql.jdbc.ArrayDecoding.PgArrayList
Value of field asArrayDecoding.PgArrayList
.protected @Nullable BaseConnection
A database connection.protected byte @Nullable []
protected @Nullable String
Field value as String. -
Constructor Summary
ConstructorDescriptionPgArray
(BaseConnection connection, int oid, byte @Nullable [] fieldBytes) Create a new Array.PgArray
(BaseConnection connection, int oid, @Nullable String fieldString) Create a new Array. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
void
free()
getArray()
getArray
(long index, int count) @Nullable Object
getArrayImpl
(long index, int count, @Nullable Map<String, Class<?>> map) getArrayImpl
(Map<String, Class<?>> map) int
getResultSet
(long index, int count) getResultSet
(long index, int count, @Nullable Map<String, Class<?>> map) getResultSet
(@Nullable Map<String, Class<?>> map) getResultSetImpl
(long index, int count, @Nullable Map<String, Class<?>> map) getResultSetImpl
(@Nullable Map<String, Class<?>> map) boolean
isBinary()
byte @Nullable []
toBytes()
@Nullable String
toString()
-
Field Details
-
connection
A database connection. -
fieldString
Field value as String. -
arrayList
protected @Nullable org.postgresql.jdbc.ArrayDecoding.PgArrayList arrayListValue of field asArrayDecoding.PgArrayList
. Will be initialized only once withinbuildArrayList(String)
. -
fieldBytes
protected byte @Nullable [] fieldBytes
-
-
Constructor Details
-
PgArray
public PgArray(BaseConnection connection, int oid, @Nullable String fieldString) throws SQLException Create a new Array.- Parameters:
connection
- a database connectionoid
- the oid of the array datatypefieldString
- the array data in string form- Throws:
SQLException
- if something wrong happens
-
PgArray
public PgArray(BaseConnection connection, int oid, byte @Nullable [] fieldBytes) throws SQLException Create a new Array.- Parameters:
connection
- a database connectionoid
- the oid of the array datatypefieldBytes
- the array data in byte form- Throws:
SQLException
- if something wrong happens
-
-
Method Details
-
getArray
- Specified by:
getArray
in interfaceArray
- Throws:
SQLException
-
getArray
- Specified by:
getArray
in interfaceArray
- Throws:
SQLException
-
getArrayImpl
- Throws:
SQLException
-
getArray
- Specified by:
getArray
in interfaceArray
- Throws:
SQLException
-
getArray
public Object getArray(long index, int count, @Nullable Map<String, Class<?>> map) throws SQLException- Specified by:
getArray
in interfaceArray
- Throws:
SQLException
-
getArrayImpl
public @Nullable Object getArrayImpl(long index, int count, @Nullable Map<String, Class<?>> map) throws SQLException- Throws:
SQLException
-
getBaseType
- Specified by:
getBaseType
in interfaceArray
- Throws:
SQLException
-
getBaseTypeName
- Specified by:
getBaseTypeName
in interfaceArray
- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSet
in interfaceArray
- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSet
in interfaceArray
- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSet
in interfaceArray
- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet(long index, int count, @Nullable Map<String, Class<?>> map) throws SQLException- Specified by:
getResultSet
in interfaceArray
- Throws:
SQLException
-
getResultSetImpl
- Throws:
SQLException
-
getResultSetImpl
public ResultSet getResultSetImpl(long index, int count, @Nullable Map<String, Class<?>> map) throws SQLException- Throws:
SQLException
-
toString
-
escapeArrayElement
-
isBinary
public boolean isBinary() -
toBytes
public byte @Nullable [] toBytes() -
free
- Specified by:
free
in interfaceArray
- Throws:
SQLException
-