Package com.mysql.cj.protocol.a.result
Class TextBufferRow
java.lang.Object
com.mysql.cj.protocol.result.AbstractResultsetRow
com.mysql.cj.protocol.a.result.AbstractBufferRow
com.mysql.cj.protocol.a.result.TextBufferRow
- All Implemented Interfaces:
ProtocolEntity,ResultsetRow,Row
public class TextBufferRow extends AbstractBufferRow
A ResultSetRow implementation that holds one row packet (which is re-used by the driver, and thus saves memory allocations), and tries when possible to avoid
allocations to break out the results as individual byte[]s.
(this isn't possible when doing things like reading floating point values).
-
Field Summary
Fields inherited from class com.mysql.cj.protocol.a.result.AbstractBufferRow
homePosition, lastRequestedIndex, lastRequestedPos, rowFromServerFields inherited from class com.mysql.cj.protocol.result.AbstractResultsetRow
exceptionInterceptor, metadata, valueDecoder, wasNull -
Constructor Summary
Constructors Constructor Description TextBufferRow(NativePacketPayload buf, ColumnDefinition cd, ExceptionInterceptor exceptionInterceptor, ValueDecoder valueDecoder) -
Method Summary
Modifier and Type Method Description protected intfindAndSeekToOffset(int index)byte[]getBytes(int index)Returns the value at the given column as a byte array.booleangetNull(int columnIndex)Check whether a column is NULL and update the 'wasNull' status.<T> TgetValue(int columnIndex, ValueFactory<T> vf)Implementation of getValue() based on the underlying Buffer object.RowsetMetadata(ColumnDefinition f)Set metadata to enable getValue functionality.Methods inherited from class com.mysql.cj.protocol.result.AbstractResultsetRow
getValueFromBytes, wasNull
-
Constructor Details
-
TextBufferRow
public TextBufferRow(NativePacketPayload buf, ColumnDefinition cd, ExceptionInterceptor exceptionInterceptor, ValueDecoder valueDecoder)
-
-
Method Details
-
findAndSeekToOffset
protected int findAndSeekToOffset(int index) -
getBytes
public byte[] getBytes(int index)Description copied from interface:RowReturns the value at the given column as a byte array. The bytes represent the raw values returned by the server.- Parameters:
index- 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
-
getNull
public boolean getNull(int columnIndex)Description copied from interface:RowCheck 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.
-
setMetadata
Description copied from interface:RowSet metadata to enable getValue functionality.- Specified by:
setMetadatain interfaceRow- Overrides:
setMetadatain classAbstractResultsetRow- Parameters:
f-ColumnDefinition- Returns:
Row
-
getValue
Implementation of getValue() based on the underlying Buffer object. Delegate to superclass for decoding.- 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
-