Class BasicStreamingDataset

java.lang.Object
com.inductiveautomation.ignition.common.AbstractDataset
com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset
All Implemented Interfaces:
Dataset, StreamingDatasetWriter, Serializable

public class BasicStreamingDataset extends AbstractDataset implements StreamingDatasetWriter
Basic implementation of StreamingDatasetWriter that simply writes each row into an in-memory datastructure ( a List )
See Also:
  • Constructor Details

    • BasicStreamingDataset

      public BasicStreamingDataset()
    • BasicStreamingDataset

      public BasicStreamingDataset(List<String> columnNames, List<Class<?>> columnTypes)
    • BasicStreamingDataset

      public BasicStreamingDataset(ResultSet rs) throws SQLException
      Creates a dataset by streaming the results of a JDBC ResultSet
      Throws:
      SQLException
    • BasicStreamingDataset

      public BasicStreamingDataset(ResultSet rs, boolean useLargestTypes) throws SQLException
      Creates a dataset by streaming the results of a JDBC ResultSet.
      Parameters:
      useLargestTypes - Forces the use of 64-bit primitives (Long, Double) instead of Integer/Float, in cases where the database does not provide a distinction between these types internally (e.g., SQLite)
      Throws:
      SQLException
  • Method Details

    • getError

      public Exception getError()
    • initialize

      public void initialize(String[] columnNames, Class<?>[] columnTypes, boolean supportsQuality, int expectedRows)
      Description copied from interface: StreamingDatasetWriter
      Initializes the streaming dataset with important information, primarily the column names and types. If supportsQuality is true, it is expected that every value added has an associated quality. expectedRows gives an idea as to how many rows will be returned- useful for progress indication. Should be -1 if the number cannot be known in advance.
      Specified by:
      initialize in interface StreamingDatasetWriter
      expectedRows - -1 if not known, otherwise the number of rows that will be in the dataset.
    • write

      public void write(Object[] data, QualityCode[] quality)
      Description copied from interface: StreamingDatasetWriter
      Writes a row with the given data. Bounds and order of arrays must match that used to call initialize. quality may be null if dataset does not support quality.
      Specified by:
      write in interface StreamingDatasetWriter
    • finish

      public void finish()
      Description copied from interface: StreamingDatasetWriter
      Notifies the writer to close- all data has been written. Should be called from a finally block.
      Specified by:
      finish in interface StreamingDatasetWriter
    • finishWithError

      public void finishWithError(Exception e)
      Description copied from interface: StreamingDatasetWriter
      Finishes the stream while indicating an error occurred. Either this, or the successful finish(), must be called.
      Specified by:
      finishWithError in interface StreamingDatasetWriter
    • getQualityAt

      public QualityCode getQualityAt(int row, int col)
      Description copied from interface: Dataset
      Returns the quality of the value at the given location.
      Specified by:
      getQualityAt in interface Dataset
      Overrides:
      getQualityAt in class AbstractDataset
    • hasQualityData

      public boolean hasQualityData()
      Description copied from interface: Dataset
      Whether this dataset has any quality data to report. If false, getQualityAt is expected to return QualityCode.Good.
      Specified by:
      hasQualityData in interface Dataset
      Overrides:
      hasQualityData in class AbstractDataset
      See Also:
    • getRowCount

      public int getRowCount()
      Description copied from interface: Dataset
      Return the number of rows in this dataset
      Specified by:
      getRowCount in interface Dataset
    • getValueAt

      public Object getValueAt(int row, int col)
      Description copied from interface: Dataset
      Returns the value in the dataset at the given location.
      Specified by:
      getValueAt in interface Dataset
    • printToConsole

      public void printToConsole()
    • getBulkQualityCodes

      public QualityCode[][] getBulkQualityCodes()
      Overrides:
      getBulkQualityCodes in class AbstractDataset