Class ResultSetRow
java.lang.Object
com.mysql.jdbc.ResultSetRow
- Direct Known Subclasses:
BufferRow, ByteArrayRow
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 Summary
FieldsModifier and TypeFieldDescriptionprotected ExceptionInterceptorprotected Field[]The metadata of the fields of this result set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidCalled during navigation to next row to close all open streams.abstract InputStreamgetBinaryInputStream(int columnIndex) Returns data at the given index as an InputStream with no character conversion.abstract intabstract byte[]getColumnValue(int index) Returns the value at the given column (index starts at 0) "raw" (i.e. as-returned by the server).protected final DategetDateFast(int columnIndex, byte[] dateAsBytes, int offset, int length, MySQLConnection conn, ResultSetImpl rs, Calendar targetCalendar) abstract DategetDateFast(int columnIndex, MySQLConnection conn, ResultSetImpl rs, Calendar targetCalendar) abstract intgetInt(int columnIndex) Returns the value at the given column (index starts at 0) as an intabstract longgetLong(int columnIndex) Returns the value at the given column (index starts at 0) as a longprotected DategetNativeDate(int columnIndex, byte[] bits, int offset, int length, MySQLConnection conn, ResultSetImpl rs, Calendar cal) abstract DategetNativeDate(int columnIndex, MySQLConnection conn, ResultSetImpl rs, Calendar cal) protected ObjectgetNativeDateTimeValue(int columnIndex, byte[] bits, int offset, int length, Calendar targetCalendar, int jdbcType, int mysqlType, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) abstract ObjectgetNativeDateTimeValue(int columnIndex, Calendar targetCalendar, int jdbcType, int mysqlType, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) protected doublegetNativeDouble(byte[] bits, int offset) abstract doublegetNativeDouble(int columnIndex) protected floatgetNativeFloat(byte[] bits, int offset) abstract floatgetNativeFloat(int columnIndex) protected intgetNativeInt(byte[] bits, int offset) abstract intgetNativeInt(int columnIndex) protected longgetNativeLong(byte[] bits, int offset) abstract longgetNativeLong(int columnIndex) protected shortgetNativeShort(byte[] bits, int offset) abstract shortgetNativeShort(int columnIndex) protected TimegetNativeTime(int columnIndex, byte[] bits, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) abstract TimegetNativeTime(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) protected TimestampgetNativeTimestamp(byte[] bits, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) abstract TimestampgetNativeTimestamp(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) abstract ReadergetReader(int columnIndex) abstract StringgetString(int index, String encoding, MySQLConnection conn) 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.protected StringgetString(String encoding, MySQLConnection conn, byte[] value, int offset, int length) Convenience method for turning a byte[] into a string with the given encoding.protected TimegetTimeFast(int columnIndex, byte[] timeAsBytes, int offset, int fullLength, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) abstract TimegetTimeFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) protected TimestampgetTimestampFast(int columnIndex, byte[] timestampAsBytes, int offset, int length, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs, boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) abstract TimestampgetTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs, boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) abstract booleanisFloatingPointNumber(int index) Could the column value at the given index (which starts at 0) be interpreted as a floating-point number (has +/-/E/e in it)?abstract booleanisNull(int index) Is the column value at the given index (which starts at 0) NULL?abstract longlength(int index) Returns the length of the column at the given index (which starts at 0).abstract voidsetColumnValue(int index, byte[] value) Sets the given column value (only works currently with ByteArrayRowHolder).setMetadata(Field[] f)
-
Field Details
-
exceptionInterceptor
-
metadata
The metadata of the fields of this result set.
-
-
Constructor Details
-
ResultSetRow
-
-
Method Details
-
closeOpenStreams
public abstract void closeOpenStreams()Called during navigation to next row to close all open streams. -
getBinaryInputStream
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
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
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
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
- Throws:
SQLException
-
getNativeFloat
protected float getNativeFloat(byte[] bits, int offset) -
getNativeFloat
- Throws:
SQLException
-
getNativeInt
protected int getNativeInt(byte[] bits, int offset) -
getNativeInt
- Throws:
SQLException
-
getNativeLong
protected long getNativeLong(byte[] bits, int offset) -
getNativeLong
- Throws:
SQLException
-
getNativeShort
protected short getNativeShort(byte[] bits, int offset) -
getNativeShort
- 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
- 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 encodingconn- 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 conversionconn- the MySQLConnection that created the result setvalue- the String value as a series of bytes, encoded using "encoding"offset- where to start the decodinglength- 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
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
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
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
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
- Throws:
SQLException
-
getBytesSize
public abstract int getBytesSize()
-