Top Description Fields Constructors Methods
com.mysql.cj.protocol.x

public Class FieldFactory

extends Object
implements ProtocolEntityFactory<Field, XMessage>
Class Inheritance
All Implemented Interfaces
com.mysql.cj.protocol.ProtocolEntityFactory
Imports
java.io.UnsupportedEncodingException, com.mysql.cj.CharsetMapping, .MysqlType, com.mysql.cj.exceptions.WrongArgumentException, com.mysql.cj.protocol.ProtocolEntityFactory, com.mysql.cj.result.Field, com.mysql.cj.util.LazyString, com.mysql.cj.x.protobuf.MysqlxResultset.ColumnMetaData, .MysqlxResultset.ColumnMetaData.FieldType

Factory producing Field from protocol message.

Field Summary

Modifier and TypeField and Description
pack-priv String
private static final int
XPROTOCOL_COLUMN_BYTES_CONTENT_TYPE_GEOMETRY

Content-type used in type mapping.

private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
FieldFactory(String metadataCharSet)

Method Summary

Modifier and TypeMethod and Description
private Field

Returns:

Field
columnMetaDataToField
(MysqlxResultset.ColumnMetaData
the message from the server
col
,
String
the encoding of the strings in the message
characterSet
)

Convert a X Protocol ColumnMetaData message to a C/J Field object.

public Field
createFromMessage(XMessage
Message instance
message
)

Overrides default com.mysql.cj.protocol.ProtocolEntityFactory.createFromMessage.

Create ProtocolEntity of type T from protocol message.

private MysqlType
findMysqlType(MysqlxResultset.ColumnMetaData.FieldType type, int contentType, int flags, int collationIndex)

private int

Returns:

A FIELD_TYPE constant from MysqlType corresponding to the combination of input parameters.
xProtocolTypeToMysqlType
(MysqlxResultset.ColumnMetaData.FieldType
the type as the ColumnMetaData.FieldType
type
,
int
the inner type
contentType
)

Map a X Protocol type code from `ColumnMetaData.FieldType' to a MySQL type constant.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

metadataCharacterSetback to summary
pack-priv String metadataCharacterSet
XPROTOCOL_COLUMN_BYTES_CONTENT_TYPE_GEOMETRYback to summary
private static final int XPROTOCOL_COLUMN_BYTES_CONTENT_TYPE_GEOMETRY

Content-type used in type mapping. c.f. mysqlx_resultset.proto

XPROTOCOL_COLUMN_BYTES_CONTENT_TYPE_JSONback to summary
private static final int XPROTOCOL_COLUMN_BYTES_CONTENT_TYPE_JSON
XPROTOCOL_COLUMN_FLAGS_AUTO_INCREMENTback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_AUTO_INCREMENT
XPROTOCOL_COLUMN_FLAGS_BYTES_RIGHTPADback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_BYTES_RIGHTPAD
XPROTOCOL_COLUMN_FLAGS_DATETIME_TIMESTAMPback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_DATETIME_TIMESTAMP
XPROTOCOL_COLUMN_FLAGS_DECIMAL_UNSIGNEDback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_DECIMAL_UNSIGNED
XPROTOCOL_COLUMN_FLAGS_DOUBLE_UNSIGNEDback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_DOUBLE_UNSIGNED
XPROTOCOL_COLUMN_FLAGS_FLOAT_UNSIGNEDback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_FLOAT_UNSIGNED
XPROTOCOL_COLUMN_FLAGS_MULTIPLE_KEYback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_MULTIPLE_KEY
XPROTOCOL_COLUMN_FLAGS_NOT_NULLback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_NOT_NULL
XPROTOCOL_COLUMN_FLAGS_PRIMARY_KEYback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_PRIMARY_KEY
XPROTOCOL_COLUMN_FLAGS_UINT_ZEROFILLback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_UINT_ZEROFILL
XPROTOCOL_COLUMN_FLAGS_UNIQUE_KEYback to summary
private static final int XPROTOCOL_COLUMN_FLAGS_UNIQUE_KEY

Constructor Detail

FieldFactoryback to summary
public FieldFactory(String metadataCharSet)

Method Detail

columnMetaDataToFieldback to summary
private Field columnMetaDataToField(MysqlxResultset.ColumnMetaData col, String characterSet)

Convert a X Protocol ColumnMetaData message to a C/J Field object.

Parameters
col:MysqlxResultset.ColumnMetaData

the message from the server

characterSet:String

the encoding of the strings in the message

Returns:Field

Field

createFromMessageback to summary
public Field createFromMessage(XMessage message)

Overrides default com.mysql.cj.protocol.ProtocolEntityFactory.createFromMessage.

Doc from com.mysql.cj.protocol.ProtocolEntityFactory.createFromMessage.

Create ProtocolEntity of type T from protocol message.

Parameters
message:XMessage

Message instance

Returns:Field

T

Annotations
@Override
findMysqlTypeback to summary
private MysqlType findMysqlType(MysqlxResultset.ColumnMetaData.FieldType type, int contentType, int flags, int collationIndex)
xProtocolTypeToMysqlTypeback to summary
private int xProtocolTypeToMysqlType(MysqlxResultset.ColumnMetaData.FieldType type, int contentType)

Map a X Protocol type code from `ColumnMetaData.FieldType' to a MySQL type constant. These are the only types that will be present in XProtocolRow results.

Parameters
type:MysqlxResultset.ColumnMetaData.FieldType

the type as the ColumnMetaData.FieldType

contentType:int

the inner type

Returns:int

A FIELD_TYPE constant from MysqlType corresponding to the combination of input parameters.