Class ResultSetRow

java.lang.Object
com.mysql.jdbc.ResultSetRow
Direct Known Subclasses:
BufferRow, ByteArrayRow

public abstract class ResultSetRow extends Object
Classes that implement this interface represent one row of data from the MySQL server that might be stored in different ways depending on whether the result set was streaming (so they wrap a reusable packet), or whether the result set was cached or via a server-side cursor (so they represent a byte[][]). Notice that no bounds checking is expected for implementors of this interface, it happens in ResultSetImpl.
  • Field Details

    • exceptionInterceptor

      protected ExceptionInterceptor exceptionInterceptor
    • metadata

      protected Field[] metadata
      The metadata of the fields of this result set.
  • Constructor Details

  • Method Details

    • closeOpenStreams

      public abstract void closeOpenStreams()
      Called during navigation to next row to close all open streams.
    • getBinaryInputStream

      public abstract InputStream getBinaryInputStream(int columnIndex) throws SQLException
      Returns data at the given index as an InputStream with no character conversion.
      Parameters:
      columnIndex - of the column value (starting at 0) to return.
      Returns:
      the value at the given index as an InputStream or null if null.
      Throws:
      SQLException - if an error occurs while retrieving the value.
    • getColumnValue

      public abstract byte[] getColumnValue(int index) throws SQLException
      Returns the value at the given column (index starts at 0) "raw" (i.e. as-returned by the server).
      Parameters:
      index - of the column value (starting at 0) to return.
      Returns:
      the value for the given column (including NULL if it is)
      Throws:
      SQLException - if an error occurs while retrieving the value.
    • getDateFast

      protected final Date getDateFast(int columnIndex, byte[] dateAsBytes, int offset, int length, MySQLConnection conn, ResultSetImpl rs, Calendar targetCalendar) throws SQLException
      Throws:
      SQLException
    • getDateFast

      public abstract Date getDateFast(int columnIndex, MySQLConnection conn, ResultSetImpl rs, Calendar targetCalendar) throws SQLException
      Throws:
      SQLException
    • getInt

      public abstract int getInt(int columnIndex) throws SQLException
      Returns the value at the given column (index starts at 0) as an int. *
      Parameters:
      index - of the column value (starting at 0) to return.
      Returns:
      the value for the given column (returns 0 if NULL, use isNull() to determine if the value was actually NULL)
      Throws:
      SQLException - if an error occurs while retrieving the value.
    • getLong

      public abstract long getLong(int columnIndex) throws SQLException
      Returns the value at the given column (index starts at 0) as a long. *
      Parameters:
      index - of the column value (starting at 0) to return.
      Returns:
      the value for the given column (returns 0 if NULL, use isNull() to determine if the value was actually NULL)
      Throws:
      SQLException - if an error occurs while retrieving the value.
    • getNativeDate

      protected Date getNativeDate(int columnIndex, byte[] bits, int offset, int length, MySQLConnection conn, ResultSetImpl rs, Calendar cal) throws SQLException
      Parameters:
      columnIndex -
      bits -
      offset -
      length -
      conn -
      rs -
      cal -
      Throws:
      SQLException
    • getNativeDate

      public abstract Date getNativeDate(int columnIndex, MySQLConnection conn, ResultSetImpl rs, Calendar cal) throws SQLException
      Throws:
      SQLException
    • getNativeDateTimeValue

      protected Object getNativeDateTimeValue(int columnIndex, byte[] bits, int offset, int length, Calendar targetCalendar, int jdbcType, int mysqlType, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getNativeDateTimeValue

      public abstract Object getNativeDateTimeValue(int columnIndex, Calendar targetCalendar, int jdbcType, int mysqlType, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getNativeDouble

      protected double getNativeDouble(byte[] bits, int offset)
    • getNativeDouble

      public abstract double getNativeDouble(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getNativeFloat

      protected float getNativeFloat(byte[] bits, int offset)
    • getNativeFloat

      public abstract float getNativeFloat(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getNativeInt

      protected int getNativeInt(byte[] bits, int offset)
    • getNativeInt

      public abstract int getNativeInt(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getNativeLong

      protected long getNativeLong(byte[] bits, int offset)
    • getNativeLong

      public abstract long getNativeLong(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getNativeShort

      protected short getNativeShort(byte[] bits, int offset)
    • getNativeShort

      public abstract short getNativeShort(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getNativeTime

      protected Time getNativeTime(int columnIndex, byte[] bits, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Parameters:
      columnIndex -
      bits -
      offset -
      length -
      targetCalendar -
      tz -
      rollForward -
      conn -
      rs -
      Throws:
      SQLException
    • getNativeTime

      public abstract Time getNativeTime(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getNativeTimestamp

      protected Timestamp getNativeTimestamp(byte[] bits, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getNativeTimestamp

      public abstract Timestamp getNativeTimestamp(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getReader

      public abstract Reader getReader(int columnIndex) throws SQLException
      Throws:
      SQLException
    • getString

      public abstract String getString(int index, String encoding, MySQLConnection conn) throws SQLException
      Returns the value at the given column (index starts at 0) as a java.lang.String with the requested encoding, using the given MySQLConnection to find character converters.
      Parameters:
      index - of the column value (starting at 0) to return.
      encoding - the Java name for the character encoding
      conn - the connection that created this result set row
      Returns:
      the value for the given column (including NULL if it is) as a String
      Throws:
      SQLException - if an error occurs while retrieving the value.
    • getString

      protected String getString(String encoding, MySQLConnection conn, byte[] value, int offset, int length) throws SQLException
      Convenience method for turning a byte[] into a string with the given encoding.
      Parameters:
      encoding - the Java encoding name for the byte[] -> char conversion
      conn - the MySQLConnection that created the result set
      value - the String value as a series of bytes, encoded using "encoding"
      offset - where to start the decoding
      length - how many bytes to decode
      Returns:
      the String as decoded from bytes with the given encoding
      Throws:
      SQLException - if an error occurs
    • getTimeFast

      protected Time getTimeFast(int columnIndex, byte[] timeAsBytes, int offset, int fullLength, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getTimeFast

      public abstract Time getTimeFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException
      Throws:
      SQLException
    • getTimestampFast

      protected Timestamp getTimestampFast(int columnIndex, byte[] timestampAsBytes, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs, boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) throws SQLException
      Throws:
      SQLException
    • getTimestampFast

      public abstract Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs, boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) throws SQLException
      Throws:
      SQLException
    • isFloatingPointNumber

      public abstract boolean isFloatingPointNumber(int index) throws SQLException
      Could the column value at the given index (which starts at 0) be interpreted as a floating-point number (has +/-/E/e in it)?
      Parameters:
      index - of the column value (starting at 0) to check.
      Returns:
      true if the column value at the given index looks like it might be a floating-point number, false if not.
      Throws:
      SQLException - if an error occurs
    • isNull

      public abstract boolean isNull(int index) throws SQLException
      Is the column value at the given index (which starts at 0) NULL?
      Parameters:
      index - of the column value (starting at 0) to check.
      Returns:
      true if the column value is NULL, false if not.
      Throws:
      SQLException - if an error occurs
    • length

      public abstract long length(int index) throws SQLException
      Returns the length of the column at the given index (which starts at 0).
      Parameters:
      index - of the column value (starting at 0) for which to return the length.
      Returns:
      the length of the requested column, 0 if null (clients of this interface should use isNull() beforehand to determine status of NULL values in the column).
      Throws:
      SQLException
    • setColumnValue

      public abstract void setColumnValue(int index, byte[] value) throws SQLException
      Sets the given column value (only works currently with ByteArrayRowHolder).
      Parameters:
      index - index of the column value (starting at 0) to set.
      value - the (raw) value to set
      Throws:
      SQLException - if an error occurs, or the concrete RowHolder doesn't support this operation.
    • setMetadata

      public ResultSetRow setMetadata(Field[] f) throws SQLException
      Throws:
      SQLException
    • getBytesSize

      public abstract int getBytesSize()