Top Description Fields Constructors Methods
com.mysql.cj.protocol.a.result

public Class BinaryBufferRow

extends AbstractBufferRow
Class Inheritance
Imports
com.mysql.cj.Messages, .MysqlType, com.mysql.cj.exceptions.ExceptionFactory, .ExceptionInterceptor, .WrongArgumentException, com.mysql.cj.protocol.ColumnDefinition, .ValueDecoder, com.mysql.cj.protocol.a.NativeConstants.IntegerDataType, .NativeConstants.StringLengthDataType, .NativeConstants.StringSelfDataType, .NativePacketPayload, .NativeUtils, com.mysql.cj.result.Row, .ValueFactory

A BufferRow implementation that holds one row packet from a server-side prepared statement (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. Rows from a server-side prepared statement are encoded differently, so we have different ways of finding where each column is, and unpacking them. (this isn't possible when doing things like reading floating point values).

Field Summary

Modifier and TypeField and Description
private boolean[]
isNull

If binary-encoded, the NULL status of each column is at the beginning of the row, so we

private int
preNullBitmaskHomePosition

The home position before the is-null bitmask for server-side prepared statement result sets

Inherited from com.mysql.cj.protocol.a.result.AbstractBufferRow:
homePositionlastRequestedIndexlastRequestedPosrowFromServer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
public byte[]
getBytes(int
index of column (starting at 0) to return from.
index
)

Overrides default com.mysql.cj.result.Row.getBytes.

Returns the value at the given column as a byte array.

public boolean
getNull(int
of the column value (starting at 0) to check.
columnIndex
)

Implements com.mysql.cj.result.Row.getNull.

Check whether a column is NULL and update the 'wasNull' status.

public <T> T
getValue(int
index of column to retrieve value from (0-indexed, not JDBC 1-indexed)
columnIndex
,
ValueFactory<T>
value factory used to create the return value after decoding
vf
)

Implements com.mysql.cj.result.Row.getValue.

Implementation of getValue() based on the underlying Buffer object.

public boolean
public void
setBytes(int
index of the column (starting at 0) to set to.
columnIndex
,
byte[]
the (raw) value to set
value
)

Overrides default com.mysql.cj.result.Row.setBytes.

Sets the given byte array as a raw column value (only works currently with ByteArrayRow).

public Row
private void
setupIsNullBitmask()

Unpacks the bitmask at the head of the row packet that tells us what columns hold null values, and sets the "home" position directly after the bitmask.

Field Detail

isNullback to summary
private boolean[] isNull

If binary-encoded, the NULL status of each column is at the beginning of the row, so we

preNullBitmaskHomePositionback to summary
private int preNullBitmaskHomePosition

The home position before the is-null bitmask for server-side prepared statement result sets

Constructor Detail

BinaryBufferRowback to summary
public BinaryBufferRow(NativePacketPayload buf, ColumnDefinition cd, ExceptionInterceptor exceptionInterceptor, ValueDecoder valueDecoder)

Method Detail

findAndSeekToOffsetback to summary
protected int findAndSeekToOffset(int index)

Implements abstract com.mysql.cj.protocol.a.result.AbstractBufferRow.findAndSeekToOffset.

Annotations
@Override
getBytesback to summary
public byte[] getBytes(int index)

Overrides default com.mysql.cj.result.Row.getBytes.

Doc from com.mysql.cj.result.Row.getBytes.

Returns the value at the given column as a byte array. The bytes represent the raw values returned by the server.

Parameters
index:int

index of column (starting at 0) to return from.

Returns:byte[]

the value for the given column; if the value is SQL NULL, the value returned is null

Annotations
@Override
getNullback to summary
public boolean getNull(int columnIndex)

Implements com.mysql.cj.result.Row.getNull.

Check whether a column is NULL and update the 'wasNull' status.

Parameters
columnIndex:int

Doc from com.mysql.cj.result.Row.getNull.

of the column value (starting at 0) to check.

Returns:boolean

Doc from com.mysql.cj.result.Row.getNull.

true if the column value is NULL, false if not.

Annotations
@Override
getValueback to summary
public <T> T getValue(int columnIndex, ValueFactory<T> vf)

Implements com.mysql.cj.result.Row.getValue.

Implementation of getValue() based on the underlying Buffer object. Delegate to superclass for decoding.

Parameters
<T>

Doc from com.mysql.cj.result.Row.getValue. type to decode to

columnIndex:int

Doc from com.mysql.cj.result.Row.getValue.

index of column to retrieve value from (0-indexed, not JDBC 1-indexed)

vf:ValueFactory<T>

Doc from com.mysql.cj.result.Row.getValue.

value factory used to create the return value after decoding

Returns:T

Doc from com.mysql.cj.result.Row.getValue.

The return value from the value factory

Annotations
@Override
isBinaryEncodedback to summary
public boolean isBinaryEncoded()

Overrides default com.mysql.cj.protocol.ResultsetRow.isBinaryEncoded.

Annotations
@Override
setBytesback to summary
public void setBytes(int columnIndex, byte[] value)

Overrides default com.mysql.cj.result.Row.setBytes.

Doc from com.mysql.cj.result.Row.setBytes.

Sets the given byte array as a raw column value (only works currently with ByteArrayRow).

Parameters
columnIndex:int

index of the column (starting at 0) to set to.

value:byte[]

the (raw) value to set

Annotations
@Override
setMetadataback to summary
public Row setMetadata(ColumnDefinition f)

Overrides com.mysql.cj.protocol.result.AbstractResultsetRow.setMetadata.

Overrides default com.mysql.cj.result.Row.setMetadata.

Doc from com.mysql.cj.result.Row.setMetadata.

Set metadata to enable getValue functionality.

Parameters
f:ColumnDefinition

ColumnDefinition

Returns:Row

Row

Annotations
@Override
setupIsNullBitmaskback to summary
private void setupIsNullBitmask()

Unpacks the bitmask at the head of the row packet that tells us what columns hold null values, and sets the "home" position directly after the bitmask.