Package org.h2.jdbc
Class JdbcArray
- java.lang.Object
-
- org.h2.message.TraceObject
-
- org.h2.jdbc.JdbcArray
-
- All Implemented Interfaces:
java.sql.Array
public final class JdbcArray extends TraceObject implements java.sql.Array
Represents an ARRAY value.
-
-
Field Summary
Fields Modifier and Type Field Description private JdbcConnection
conn
private ValueArray
value
-
Fields inherited from class org.h2.message.TraceObject
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID
-
-
Constructor Summary
Constructors Constructor Description JdbcArray(JdbcConnection conn, Value value, int id)
INTERNAL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkClosed()
private static int
checkRange(long index, int count, int len)
void
free()
Release all resources of this object.private java.lang.Object
get()
private java.lang.Object
get(long index, int count)
java.lang.Object
getArray()
Returns the value as a Java array.java.lang.Object
getArray(long index, int count)
Returns the value as a Java array.java.lang.Object
getArray(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)
Returns the value as a Java array.java.lang.Object
getArray(java.util.Map<java.lang.String,java.lang.Class<?>> map)
Returns the value as a Java array.int
getBaseType()
Returns the base type of the array.java.lang.String
getBaseTypeName()
Returns the base type name of the array.java.sql.ResultSet
getResultSet()
Returns the value as a result set.java.sql.ResultSet
getResultSet(long index, int count)
Returns the value as a result set.java.sql.ResultSet
getResultSet(long index, int count, java.util.Map<java.lang.String,java.lang.Class<?>> map)
Returns the value as a result set.java.sql.ResultSet
getResultSet(java.util.Map<java.lang.String,java.lang.Class<?>> map)
Returns the value as a result set.private java.sql.ResultSet
getResultSetImpl(long index, int count)
java.lang.String
toString()
INTERNAL-
Methods inherited from class org.h2.message.TraceObject
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
-
-
-
-
Field Detail
-
value
private ValueArray value
-
conn
private final JdbcConnection conn
-
-
Constructor Detail
-
JdbcArray
public JdbcArray(JdbcConnection conn, Value value, int id)
INTERNAL- Parameters:
conn
- it belongs tovalue
- ofid
- of the trace object
-
-
Method Detail
-
getArray
public java.lang.Object getArray() throws java.sql.SQLException
Returns the value as a Java array. This method always returns an Object[].- Specified by:
getArray
in interfacejava.sql.Array
- Returns:
- the Object array
- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException
Returns the value as a Java array. This method always returns an Object[].- Specified by:
getArray
in interfacejava.sql.Array
- Parameters:
map
- is ignored. Only empty or null maps are supported- Returns:
- the Object array
- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray(long index, int count) throws java.sql.SQLException
Returns the value as a Java array. A subset of the array is returned, starting from the index (1 meaning the first element) and up to the given object count. This method always returns an Object[].- Specified by:
getArray
in interfacejava.sql.Array
- Parameters:
index
- the start index of the subset (starting with 1)count
- the maximum number of values- Returns:
- the Object 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
Returns the value as a Java array. A subset of the array is returned, starting from the index (1 meaning the first element) and up to the given object count. This method always returns an Object[].- Specified by:
getArray
in interfacejava.sql.Array
- Parameters:
index
- the start index of the subset (starting with 1)count
- the maximum number of valuesmap
- is ignored. Only empty or null maps are supported- Returns:
- the Object array
- Throws:
java.sql.SQLException
-
getBaseType
public int getBaseType() throws java.sql.SQLException
Returns the base type of the array.- Specified by:
getBaseType
in interfacejava.sql.Array
- Returns:
- the base type or Types.NULL
- Throws:
java.sql.SQLException
-
getBaseTypeName
public java.lang.String getBaseTypeName() throws java.sql.SQLException
Returns the base type name of the array. This database does support mixed type arrays and therefore there is no base type.- Specified by:
getBaseTypeName
in interfacejava.sql.Array
- Returns:
- the base type name or "NULL"
- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
Returns the value as a result set. The first column contains the index (starting with 1) and the second column the value.- Specified by:
getResultSet
in interfacejava.sql.Array
- Returns:
- the result set
- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException
Returns the value as a result set. The first column contains the index (starting with 1) and the second column the value.- Specified by:
getResultSet
in interfacejava.sql.Array
- Parameters:
map
- is ignored. Only empty or null maps are supported- Returns:
- the result set
- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet(long index, int count) throws java.sql.SQLException
Returns the value as a result set. The first column contains the index (starting with 1) and the second column the value. A subset of the array is returned, starting from the index (1 meaning the first element) and up to the given object count.- Specified by:
getResultSet
in interfacejava.sql.Array
- Parameters:
index
- the start index of the subset (starting with 1)count
- the maximum number of values- Returns:
- the result set
- 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
Returns the value as a result set. The first column contains the index (starting with 1) and the second column the value. A subset of the array is returned, starting from the index (1 meaning the first element) and up to the given object count.- Specified by:
getResultSet
in interfacejava.sql.Array
- Parameters:
index
- the start index of the subset (starting with 1)count
- the maximum number of valuesmap
- is ignored. Only empty or null maps are supported- Returns:
- the result set
- Throws:
java.sql.SQLException
-
free
public void free()
Release all resources of this object.- Specified by:
free
in interfacejava.sql.Array
-
getResultSetImpl
private java.sql.ResultSet getResultSetImpl(long index, int count)
-
checkClosed
private void checkClosed()
-
get
private java.lang.Object get()
-
get
private java.lang.Object get(long index, int count)
-
checkRange
private static int checkRange(long index, int count, int len)
-
toString
public java.lang.String toString()
INTERNAL- Overrides:
toString
in classjava.lang.Object
-
-