Class MemoryResultSet
- java.lang.Object
-
- org.pentaho.commons.connection.memory.MemoryResultSet
-
- All Implemented Interfaces:
IDisposable,IMultiDimensionalResultSet,IPeekable,IPentahoResultSet
public class MemoryResultSet extends Object implements IPentahoResultSet, IPeekable, IMultiDimensionalResultSet
-
-
Constructor Summary
Constructors Constructor Description MemoryResultSet()MemoryResultSet(IPentahoMetaData metaData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddRow(Object[] row)voidbeforeFirst()Moves the cursor to before the first rowvoidclose()Close the queryvoidcloseConnection()Close the connection used by this result setstatic MemoryResultSetcreateFromActionSequenceInputsNode(org.dom4j.Node rootNode)static MemoryResultSetcreateFromArrays(Object[][] colHeads, Object[][] theRows)static MemoryResultSetcreateFromLists(List colHeaders, List data)static MemoryResultSetcreateList(String name, List items)voiddispose()Disposes of this object's resourcesintgetColumnCount()Returns the rowCount from the result set.Object[]getDataColumn(int column)Get a column of data.Object[]getDataRow(int row)Get a specified row of dataIPentahoMetaDatagetMetaData()static StringgetNodeText(String xpath, org.dom4j.Node rootNode)static StringgetNodeText(String xpath, org.dom4j.Node rootNode, String defaultValue)intgetRowCount()Get a rowCount from the resultset.ListgetRows()ObjectgetValueAt(int row, int column)Returns the value of the specified row and the specified column from within the resultset.booleanisScrollable()Indicates whether the result set is scrollableIPentahoResultSetmemoryCopy()Attention: It does not clone data!Object[]next()Object[]nextFlattened()Gets the next flattened row.Object[]peek()Peeks into a result set object to get a preview of the next row of data.Object[]peekFlattened()Peeks at the next flattened row.voidsetMetaData(IPentahoMetaData metaData)voidsetRows(List rows)
-
-
-
Constructor Detail
-
MemoryResultSet
public MemoryResultSet()
-
MemoryResultSet
public MemoryResultSet(IPentahoMetaData metaData)
-
-
Method Detail
-
setMetaData
public void setMetaData(IPentahoMetaData metaData)
-
setRows
public void setRows(List rows)
-
getRows
public List getRows()
-
addRow
public int addRow(Object[] row)
-
getMetaData
public IPentahoMetaData getMetaData()
- Specified by:
getMetaDatain interfaceIPentahoResultSet- Returns:
- the Metadata object that resulted from the most recent query.
-
peek
public Object[] peek()
Description copied from interface:IPeekablePeeks into a result set object to get a preview of the next row of data. This is an optional interface that IPentahoResultSet objects can implement
-
next
public Object[] next()
- Specified by:
nextin interfaceIPentahoResultSet- Returns:
- an object array that represents the data in each column of the next row.
-
close
public void close()
Description copied from interface:IPentahoResultSetClose the query- Specified by:
closein interfaceIPentahoResultSet
-
closeConnection
public void closeConnection()
Description copied from interface:IPentahoResultSetClose the connection used by this result set- Specified by:
closeConnectionin interfaceIPentahoResultSet
-
dispose
public void dispose()
Description copied from interface:IDisposableDisposes of this object's resources- Specified by:
disposein interfaceIDisposable
-
createFromArrays
public static MemoryResultSet createFromArrays(Object[][] colHeads, Object[][] theRows)
-
createFromLists
public static MemoryResultSet createFromLists(List colHeaders, List data)
- Parameters:
colHeaders- List of Objects, where each object represents a column header in the metadata of the result set. Most likely will be a List of String.data- List of (List of Objects). Each List of Objects will become a row of the ResultSet.- Returns:
- MemoryResultSet
-
createList
public static MemoryResultSet createList(String name, List items)
- Parameters:
name-items- List of Object[] (list of array of objects). Each item in the list will become an row of the ResultSet- Returns:
- MemoryResultSet
-
createFromActionSequenceInputsNode
public static MemoryResultSet createFromActionSequenceInputsNode(org.dom4j.Node rootNode)
-
getNodeText
public static String getNodeText(String xpath, org.dom4j.Node rootNode, String defaultValue)
-
isScrollable
public boolean isScrollable()
Description copied from interface:IPentahoResultSetIndicates whether the result set is scrollable- Specified by:
isScrollablein interfaceIPentahoResultSet- Returns:
- true if the resultset can be scrolled through.
-
getRowCount
public int getRowCount()
Description copied from interface:IPentahoResultSetGet a rowCount from the resultset.- Specified by:
getRowCountin interfaceIPentahoResultSet- Returns:
- the row count.
-
getValueAt
public Object getValueAt(int row, int column)
Returns the value of the specified row and the specified column from within the resultset.- Specified by:
getValueAtin interfaceIPentahoResultSet- Parameters:
row- the row index.column- the column index.- Returns:
- the value.
-
getColumnCount
public int getColumnCount()
Description copied from interface:IPentahoResultSetReturns the rowCount from the result set.- Specified by:
getColumnCountin interfaceIPentahoResultSet- Returns:
-
memoryCopy
public IPentahoResultSet memoryCopy()
Attention: It does not clone data! It is create the shallow copy of metadata! It is create the shallow copy of data. You must avoid to use this method.- Specified by:
memoryCopyin interfaceIPentahoResultSet- Returns:
- new instance the
MemoryResultSetwith same metadata
-
beforeFirst
public void beforeFirst()
Description copied from interface:IPentahoResultSetMoves the cursor to before the first row- Specified by:
beforeFirstin interfaceIPentahoResultSet
-
getDataColumn
public Object[] getDataColumn(int column)
Description copied from interface:IPentahoResultSetGet a column of data.- Specified by:
getDataColumnin interfaceIPentahoResultSet- Parameters:
column- the zero based column number- Returns:
- array represeting a column of data. 0th element is the first column
-
getDataRow
public Object[] getDataRow(int row)
Description copied from interface:IPentahoResultSetGet a specified row of data- Specified by:
getDataRowin interfaceIPentahoResultSet- Parameters:
row- the zero base row number- Returns:
- array representing a row of data. 0th element is the top row
-
nextFlattened
public Object[] nextFlattened()
Description copied from interface:IMultiDimensionalResultSetGets the next flattened row. This includes the row headers (if any)- Specified by:
nextFlattenedin interfaceIMultiDimensionalResultSet- Returns:
-
peekFlattened
public Object[] peekFlattened()
Description copied from interface:IMultiDimensionalResultSetPeeks at the next flattened row. This includes the row headers (if any)- Specified by:
peekFlattenedin interfaceIMultiDimensionalResultSet- Returns:
-
-