Package org.postgresql.jdbc
Class PgArray
- java.lang.Object
-
- org.postgresql.jdbc.PgArray
-
- All Implemented Interfaces:
java.sql.Array
public class PgArray extends java.lang.Object implements java.sql.ArrayArray 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 java.lang.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, java.lang.String fieldString)Create a new Array.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidescapeArrayElement(java.lang.StringBuilder b, java.lang.String s)voidfree()java.lang.ObjectgetArray()java.lang.ObjectgetArray(long index, int count)java.lang.ObjectgetArray(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)java.lang.ObjectgetArray(java.util.Map<java.lang.String,java.lang.Class<?>> map)java.lang.ObjectgetArrayImpl(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)java.lang.ObjectgetArrayImpl(java.util.Map<java.lang.String,java.lang.Class<?>> map)intgetBaseType()java.lang.StringgetBaseTypeName()java.sql.ResultSetgetResultSet()java.sql.ResultSetgetResultSet(long index, int count)java.sql.ResultSetgetResultSet(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)java.sql.ResultSetgetResultSet(java.util.Map<java.lang.String,java.lang.Class<?>> map)java.sql.ResultSetgetResultSetImpl(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)java.sql.ResultSetgetResultSetImpl(java.util.Map<java.lang.String,java.lang.Class<?>> map)booleanisBinary()byte[]toBytes()java.lang.StringtoString()
-
-
-
Field Detail
-
connection
protected BaseConnection connection
A database connection.
-
fieldString
protected java.lang.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, java.lang.String fieldString) throws java.sql.SQLException
Create a new Array.- Parameters:
connection- a database connectionoid- the oid of the array datatypefieldString- the array data in string form- Throws:
java.sql.SQLException- if something wrong happens
-
PgArray
public PgArray(BaseConnection connection, int oid, byte[] fieldBytes) throws java.sql.SQLException
Create a new Array.- Parameters:
connection- a database connectionoid- the oid of the array datatypefieldBytes- the array data in byte form- Throws:
java.sql.SQLException- if something wrong happens
-
-
Method Detail
-
getArray
public java.lang.Object getArray() throws java.sql.SQLException- Specified by:
getArrayin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray(long index, int count) throws java.sql.SQLException- Specified by:
getArrayin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getArrayImpl
public java.lang.Object getArrayImpl(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Specified by:
getArrayin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Specified by:
getArrayin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getArrayImpl
public java.lang.Object getArrayImpl(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBaseType
public int getBaseType() throws java.sql.SQLException- Specified by:
getBaseTypein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getBaseTypeName
public java.lang.String getBaseTypeName() throws java.sql.SQLException- Specified by:
getBaseTypeNamein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet(long index, int count) throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getResultSetImpl
public java.sql.ResultSet getResultSetImpl(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getResultSetImpl
public java.sql.ResultSet getResultSetImpl(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
escapeArrayElement
public static void escapeArrayElement(java.lang.StringBuilder b, java.lang.String s)
-
isBinary
public boolean isBinary()
-
toBytes
public byte[] toBytes()
-
free
public void free() throws java.sql.SQLException- Specified by:
freein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
-