Package org.apache.calcite.avatica.util
Class ArrayFactoryImpl
- java.lang.Object
-
- org.apache.calcite.avatica.util.ArrayFactoryImpl
-
- All Implemented Interfaces:
ArrayImpl.Factory
- Direct Known Subclasses:
AvaticaResultSet
public class ArrayFactoryImpl extends java.lang.Object implements ArrayImpl.Factory
Implementation ofArrayImpl.Factory.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.TimeZonetimeZone
-
Constructor Summary
Constructors Constructor Description ArrayFactoryImpl(java.util.TimeZone timeZone)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ResultSetcreate(ColumnMetaData.AvaticaType elementType, java.lang.Iterable<java.lang.Object> elements)Creates aResultSetfrom the given list of values perArray.getResultSet().java.sql.ArraycreateArray(ColumnMetaData.AvaticaType elementType, java.lang.Iterable<java.lang.Object> elements)Creates anArrayfrom the given list of values, converting any primitive values into the corresponding objects.private java.util.List<java.util.List<java.lang.Object>>createResultSetRowsForArrayData(java.lang.Iterable<java.lang.Object> elements)Creates the row-level view over the values that will make up an Array.private java.util.Iterator<java.util.List<java.lang.Object>>createRowForArrayData(java.util.List<java.lang.Object> elements)Creates an row-level view over the values that will make up an Array.
-
-
-
Method Detail
-
create
public java.sql.ResultSet create(ColumnMetaData.AvaticaType elementType, java.lang.Iterable<java.lang.Object> elements) throws java.sql.SQLException
Description copied from interface:ArrayImpl.FactoryCreates aResultSetfrom the given list of values perArray.getResultSet().- Specified by:
createin interfaceArrayImpl.Factory- Parameters:
elementType- The type of the elementselements- The elements- Throws:
java.sql.SQLException- on error
-
createArray
public java.sql.Array createArray(ColumnMetaData.AvaticaType elementType, java.lang.Iterable<java.lang.Object> elements)
Description copied from interface:ArrayImpl.FactoryCreates anArrayfrom the given list of values, converting any primitive values into the corresponding objects.- Specified by:
createArrayin interfaceArrayImpl.Factory- Parameters:
elementType- The type of the elementselements- The elements
-
createResultSetRowsForArrayData
private java.util.List<java.util.List<java.lang.Object>> createResultSetRowsForArrayData(java.lang.Iterable<java.lang.Object> elements)
Creates the row-level view over the values that will make up an Array. The Iterator has a row per Array element, each row containing two columns. The second column is the array element and the first column is the offset into the array of that array element (one-based, not zero-based).The ordering of the rows is not guaranteed to be in the same order as the array elements.
A list of
elements:[1, 2, 3]
might be converted into
Iterator{ [1, 1], [2, 2], [3, 3] }- Parameters:
elements- The elements of an array.
-
createRowForArrayData
private java.util.Iterator<java.util.List<java.lang.Object>> createRowForArrayData(java.util.List<java.lang.Object> elements)
Creates an row-level view over the values that will make up an Array. The Iterator has one entry which has a list that also has one entry.A provided list of
elements[1, 2, 3]
would be converted into
Iterator{ [ [1,2,3] ] }- Parameters:
elements- The elements of an array
-
-