Package com.mysql.cj.result
Interface Row
- All Superinterfaces:
ProtocolEntity
- All Known Subinterfaces:
ResultsetRow
- All Known Implementing Classes:
AbstractBufferRow
,AbstractResultsetRow
,BinaryBufferRow
,ByteArrayRow
,TextBufferRow
,XProtocolRow
public interface Row extends ProtocolEntity
-
Method Summary
Modifier and Type Method Description default byte[]
getBytes(int columnIndex)
Returns the value at the given column as a byte array.boolean
getNull(int columnIndex)
Check whether a column is NULL and update the 'wasNull' status.<T> T
getValue(int columnIndex, ValueFactory<T> vf)
Retrieve a value for the given column.default void
setBytes(int columnIndex, byte[] value)
Sets the given byte array as a raw column value (only works currently with ByteArrayRow).default Row
setMetadata(ColumnDefinition columnDefinition)
Set metadata to enable getValue functionality.boolean
wasNull()
Was the last value retrieved a NULL value?
-
Method Details
-
getValue
Retrieve a value for the given column. This is the main facility to access values from the Row involvingValueDecoder
andValueFactory
chain. Metadata must be set via Row constructor orsetMetadata(ColumnDefinition)
call before calling this method to allow correct columnIndex boundaries check and data type recognition.- Type Parameters:
T
- type to decode to- Parameters:
columnIndex
- index of column to retrieve value from (0-indexed, not JDBC 1-indexed)vf
- value factory used to create the return value after decoding- Returns:
- The return value from the value factory
-
setMetadata
Set metadata to enable getValue functionality.- Parameters:
columnDefinition
-ColumnDefinition
- Returns:
Row
-
getBytes
default byte[] getBytes(int columnIndex)Returns the value at the given column as a byte array. The bytes represent the raw values returned by the server.- Parameters:
columnIndex
- index of column (starting at 0) to return from.- Returns:
- the value for the given column; if the value is SQL
NULL
, the value returned isnull
-
setBytes
default void setBytes(int columnIndex, byte[] value)Sets the given byte array as a raw column value (only works currently with ByteArrayRow).- Parameters:
columnIndex
- index of the column (starting at 0) to set to.value
- the (raw) value to set
-
getNull
boolean getNull(int columnIndex)Check whether a column is NULL and update the 'wasNull' status.- Parameters:
columnIndex
- of the column value (starting at 0) to check.- Returns:
- true if the column value is NULL, false if not.
-
wasNull
boolean wasNull()Was the last value retrieved a NULL value?- Returns:
- true if the last retrieved value was NULL.
-