Package org.postgresql.jdbc
Class PgArray
- java.lang.Object
-
- org.postgresql.jdbc.PgArray
-
- All Implemented Interfaces:
Array
public class PgArray extends Object implements 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:
ResultSet.getArray(int)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.postgresql.jdbc.ArrayDecoding.PgArrayListarrayListValue of field asArrayDecoding.PgArrayList.protected BaseConnectionconnectionA database connection.protected byte[]fieldBytesprotected StringfieldStringField value as String.
-
Constructor Summary
Constructors Constructor Description PgArray(BaseConnection connection, int oid, byte[] fieldBytes)Create a new Array.PgArray(BaseConnection connection, int oid, String fieldString)Create a new Array.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidescapeArrayElement(StringBuilder b, String s)voidfree()ObjectgetArray()ObjectgetArray(long index, int count)ObjectgetArray(long index, int count, Map<String,Class<?>> map)ObjectgetArray(Map<String,Class<?>> map)ObjectgetArrayImpl(long index, int count, Map<String,Class<?>> map)ObjectgetArrayImpl(Map<String,Class<?>> map)intgetBaseType()StringgetBaseTypeName()ResultSetgetResultSet()ResultSetgetResultSet(long index, int count)ResultSetgetResultSet(long index, int count, Map<String,Class<?>> map)ResultSetgetResultSet(Map<String,Class<?>> map)ResultSetgetResultSetImpl(long index, int count, Map<String,Class<?>> map)ResultSetgetResultSetImpl(Map<String,Class<?>> map)booleanisBinary()byte[]toBytes()StringtoString()
-
-
-
Field Detail
-
connection
protected BaseConnection connection
A database connection.
-
fieldString
protected String fieldString
Field value as String.
-
arrayList
protected org.postgresql.jdbc.ArrayDecoding.PgArrayList arrayList
Value of field asArrayDecoding.PgArrayList. Will be initialized only once withinbuildArrayList(String).
-
fieldBytes
protected byte[] fieldBytes
-
-
Constructor Detail
-
PgArray
public PgArray(BaseConnection connection, int oid, 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[] 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 Detail
-
getArray
public Object getArray() throws SQLException
- Specified by:
getArrayin interfaceArray- Throws:
SQLException
-
getArray
public Object getArray(long index, int count) throws SQLException
- Specified by:
getArrayin interfaceArray- Throws:
SQLException
-
getArrayImpl
public Object getArrayImpl(Map<String,Class<?>> map) throws SQLException
- Throws:
SQLException
-
getArray
public Object getArray(Map<String,Class<?>> map) throws SQLException
- Specified by:
getArrayin interfaceArray- Throws:
SQLException
-
getArray
public Object getArray(long index, int count, Map<String,Class<?>> map) throws SQLException
- Specified by:
getArrayin interfaceArray- Throws:
SQLException
-
getArrayImpl
public Object getArrayImpl(long index, int count, Map<String,Class<?>> map) throws SQLException
- Throws:
SQLException
-
getBaseType
public int getBaseType() throws SQLException- Specified by:
getBaseTypein interfaceArray- Throws:
SQLException
-
getBaseTypeName
public String getBaseTypeName() throws SQLException
- Specified by:
getBaseTypeNamein interfaceArray- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet() throws SQLException
- Specified by:
getResultSetin interfaceArray- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet(long index, int count) throws SQLException
- Specified by:
getResultSetin interfaceArray- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet(Map<String,Class<?>> map) throws SQLException
- Specified by:
getResultSetin interfaceArray- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet(long index, int count, Map<String,Class<?>> map) throws SQLException
- Specified by:
getResultSetin interfaceArray- Throws:
SQLException
-
getResultSetImpl
public ResultSet getResultSetImpl(Map<String,Class<?>> map) throws SQLException
- Throws:
SQLException
-
getResultSetImpl
public ResultSet getResultSetImpl(long index, int count, Map<String,Class<?>> map) throws SQLException
- Throws:
SQLException
-
escapeArrayElement
public static void escapeArrayElement(StringBuilder b, String s)
-
isBinary
public boolean isBinary()
-
toBytes
public byte[] toBytes()
-
free
public void free() throws SQLException- Specified by:
freein interfaceArray- Throws:
SQLException
-
-