Package org.apache.calcite.avatica.util
Class ArrayImpl
- java.lang.Object
-
- org.apache.calcite.avatica.util.ArrayImpl
-
- All Implemented Interfaces:
java.sql.Array
public class ArrayImpl extends java.lang.Object implements java.sql.ArrayImplementation of JDBCArray.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceArrayImpl.FactoryFactory that can create a ResultSet or Array based on a stream of values.
-
Field Summary
Fields Modifier and Type Field Description private AbstractCursor.ArrayAccessoraccessorprivate java.util.List<java.lang.Object>list
-
Constructor Summary
Constructors Constructor Description ArrayImpl(java.util.List<java.lang.Object> list, AbstractCursor.ArrayAccessor accessor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappend(java.lang.StringBuilder buf, java.lang.Object o)static booleanequalContents(java.sql.Array left, java.sql.Array right)Returns whether two arrays have the same contents.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)protected java.lang.ObjectgetArray(java.util.List<?> list, AbstractCursor.ArrayAccessor arrayAccessor)Converts a list into an array.java.lang.ObjectgetArray(java.util.Map<java.lang.String,java.lang.Class<?>> map)(package private) java.lang.ObjectgetArrayData(java.lang.Object o, AbstractCursor.ArrayAccessor componentAccessor)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.lang.StringtoString()
-
-
-
Field Detail
-
list
private final java.util.List<java.lang.Object> list
-
accessor
private final AbstractCursor.ArrayAccessor accessor
-
-
Constructor Detail
-
ArrayImpl
public ArrayImpl(java.util.List<java.lang.Object> list, AbstractCursor.ArrayAccessor accessor)
-
-
Method Detail
-
getBaseTypeName
public java.lang.String getBaseTypeName() throws java.sql.SQLException- Specified by:
getBaseTypeNamein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getBaseType
public int getBaseType() throws java.sql.SQLException- Specified by:
getBaseTypein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
getArray
public java.lang.Object getArray() throws java.sql.SQLException- Specified by:
getArrayin interfacejava.sql.Array- Throws:
java.sql.SQLException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
append
private void append(java.lang.StringBuilder buf, java.lang.Object o)
-
getArray
protected java.lang.Object getArray(java.util.List<?> list, AbstractCursor.ArrayAccessor arrayAccessor) throws java.sql.SQLExceptionConverts a list into an array.If the elements of the list are primitives, converts to an array of primitives (e.g.
boolean[].- Parameters:
list- List of objects- Returns:
- array
- Throws:
java.lang.ClassCastException- if any element is not of the box typejava.lang.NullPointerException- if any element is nulljava.sql.SQLException
-
getArrayData
java.lang.Object getArrayData(java.lang.Object o, AbstractCursor.ArrayAccessor componentAccessor) 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) 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
-
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(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) 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
-
free
public void free() throws java.sql.SQLException- Specified by:
freein interfacejava.sql.Array- Throws:
java.sql.SQLException
-
equalContents
public static boolean equalContents(java.sql.Array left, java.sql.Array right) throws java.sql.SQLExceptionReturns whether two arrays have the same contents.Arrays must have the same size, and elements in the same order. Elements are compared using
Object.equals(Object), and null values are equal to each other.- Throws:
java.sql.SQLException
-
-