Class JDBCFeatureReader

    • Field Detail

      • LOGGER

        protected static final Logger LOGGER
      • TRACE_ENABLED

        protected static final Boolean TRACE_ENABLED
        When true, the stack trace that created a reader that wasn't closed is recorded and then printed out when warning the user about this.
      • featureSource

        protected JDBCFeatureSource featureSource
        The feature source the reader originated from.
      • geometryFactory

        protected GeometryFactory geometryFactory
        geometry factory used to create geometry objects
      • query

        protected Query query
        the query
      • hints

        protected Hints hints
        hints
      • screenMap

        protected ScreenMap screenMap
        Screenmap for feature skipping behaviour
      • next

        protected Boolean next
        flag indicating if the iterator has another feature
      • st

        protected Statement st
        statement,result set that is being worked from.
      • rs

        protected ResultSet rs
      • cx

        protected Connection cx
      • md

        protected ResultSetMetaData md
      • tracer

        protected Exception tracer
      • columnNames

        protected String[] columnNames
      • offset

        protected int offset
        offset/column index to start reading from result set
    • Constructor Detail

      • JDBCFeatureReader

        public JDBCFeatureReader​(String sql,
                                 Connection cx,
                                 JDBCFeatureSource featureSource,
                                 SimpleFeatureType featureType,
                                 Query query)
                          throws SQLException
        Throws:
        SQLException
      • JDBCFeatureReader

        public JDBCFeatureReader​(PreparedStatement st,
                                 Connection cx,
                                 JDBCFeatureSource featureSource,
                                 SimpleFeatureType featureType,
                                 Query query)
                          throws SQLException
        Throws:
        SQLException
      • JDBCFeatureReader

        public JDBCFeatureReader​(ResultSet rs,
                                 Connection cx,
                                 int offset,
                                 JDBCFeatureSource featureSource,
                                 SimpleFeatureType featureType,
                                 Query query)
                          throws SQLException
        Throws:
        SQLException
    • Method Detail

      • setNext

        public void setNext​(Boolean next)
      • getPrimaryKey

        public PrimaryKey getPrimaryKey()
      • getQuery

        public Query getQuery()
      • hasNext

        public boolean hasNext()
                        throws IOException
        Description copied from interface: FeatureReader
        Query whether this FeatureReader has another Feature.
        Specified by:
        hasNext in interface FeatureReader<SimpleFeatureType,​SimpleFeature>
        Returns:
        True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
        Throws:
        IOException - If an error occurs determining if there are more Features.
      • readNextFeature

        protected SimpleFeature readNextFeature()
                                         throws IOException
        Throws:
        IOException
      • ensureNext

        protected void ensureNext()
      • ensureOpen

        protected void ensureOpen()
                           throws IOException
        Throws:
        IOException
      • next

        public SimpleFeature next()
                           throws IOException,
                                  IllegalArgumentException,
                                  NoSuchElementException
        Description copied from interface: FeatureReader
        Reads the next Feature in the FeatureReader.
        Specified by:
        next in interface FeatureReader<SimpleFeatureType,​SimpleFeature>
        Returns:
        The next feature in the reader.
        Throws:
        IOException - If an error occurs reading the Feature.
        NoSuchElementException - If there are no more Features in the Reader.
        IllegalArgumentException
      • close

        public void close()
                   throws IOException
        Description copied from interface: FeatureReader
        Release the underlying resources associated with this stream.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface FeatureReader<SimpleFeatureType,​SimpleFeature>
        Throws:
        IOException - if an I/O error occurs
      • cleanup

        protected void cleanup()
                        throws IOException
        Cleans up the reader state without closing the accessory resultset, statement and connection. Use only if the above are shared with another object that will take care of closing them.
        Throws:
        IOException
      • finalize

        protected void finalize()
                         throws Throwable
        Overrides:
        finalize in class Object
        Throws:
        Throwable