Class AbstractCursor

  • All Implemented Interfaces:
    java.lang.AutoCloseable, Cursor
    Direct Known Subclasses:
    PositionedCursor

    public abstract class AbstractCursor
    extends java.lang.Object
    implements Cursor
    Base class for implementing a cursor.

    Derived class needs to provide AbstractCursor.Getter and can override Cursor.Accessor implementations if it wishes.

    • Field Detail

      • wasNull

        protected final boolean[] wasNull
        Slot into which each accessor should write whether the value returned was null.
    • Constructor Detail

      • AbstractCursor

        protected AbstractCursor()
    • Method Detail

      • wasNull

        public boolean wasNull()
        Description copied from interface: Cursor
        Returns whether the last value returned was null.
        Specified by:
        wasNull in interface Cursor
      • createAccessors

        public java.util.List<Cursor.Accessor> createAccessors​(java.util.List<ColumnMetaData> types,
                                                               java.util.Calendar localCalendar,
                                                               ArrayImpl.Factory factory)
        Description copied from interface: Cursor
        Creates a list of accessors, one per column.
        Specified by:
        createAccessors in interface Cursor
        Parameters:
        types - List of column types, per Types.
        localCalendar - Calendar in local time zone
        factory - Factory that creates sub-ResultSets when needed
        Returns:
        List of column accessors
      • next

        public abstract boolean next()
        Description copied from interface: Cursor
        Moves to the next row.
        Specified by:
        next in interface Cursor
        Returns:
        Whether moved
      • timestampAsString

        private static java.lang.String timestampAsString​(long v,
                                                          java.util.Calendar calendar)
        Accesses a timestamp value as a string. The timestamp is in SQL format (e.g. "2013-09-22 22:30:32"), not Java format ("2013-09-22 22:30:32.123").
      • dateAsString

        private static java.lang.String dateAsString​(int v,
                                                     java.util.Calendar calendar)
        Accesses a date value as a string, e.g. "2013-09-22".
      • timeAsString

        private static java.lang.String timeAsString​(int v,
                                                     java.util.Calendar calendar)
        Accesses a time value as a string, e.g. "22:30:32".
      • longToDate

        private static java.sql.Date longToDate​(long v,
                                                java.util.Calendar calendar)
      • intToTime

        static java.sql.Time intToTime​(int v,
                                       java.util.Calendar calendar)
      • longToTimestamp

        static java.sql.Timestamp longToTimestamp​(long v,
                                                  java.util.Calendar calendar)