use of io.vertx.mysqlclient.impl.protocol.ColumnDefinition in project Mycat2 by MyCATApache.
the class QueryCommandBaseCodec method handleResultsetColumnDefinitions.
protected void handleResultsetColumnDefinitions(ByteBuf payload) {
ColumnDefinition def = decodeColumnDefinitionPacketPayload(payload);
columnDefinitions[currentColumn++] = def;
if (currentColumn == columnDefinitions.length) {
// all column definitions have been decoded, switch to column definitions decoding completed state
if (isDeprecatingEofFlagEnabled()) {
// we enabled the DEPRECATED_EOF flag and don't need to accept an EOF_Packet
handleResultsetColumnDefinitionsDecodingCompleted();
} else {
// we need to decode an EOF_Packet before handling rows, to be compatible with MySQL version below 5.7.5
commandHandlerState = CommandHandlerState.COLUMN_DEFINITIONS_DECODING_COMPLETED;
}
}
}
use of io.vertx.mysqlclient.impl.protocol.ColumnDefinition in project Mycat2 by MyCATApache.
the class BaseRowObservable method toColumnMetaData.
public static MycatRowMetaData toColumnMetaData(List<ColumnDescriptor> event) {
ResultSetBuilder resultSetBuilder = ResultSetBuilder.create();
for (ColumnDescriptor columnDescriptor : event) {
if (columnDescriptor instanceof ColumnDefinition) {
ColumnDefinition columnDefinition = (ColumnDefinition) columnDescriptor;
String schemaName = columnDefinition.schema();
String tableName = columnDefinition.orgTable();
String columnName = columnDefinition.name();
int columnType = columnDefinition.type().jdbcType.getVendorTypeNumber();
int precision = 0;
int scale = 0;
String columnLabel = columnDefinition.name();
boolean isAutoIncrement = false;
boolean isCaseSensitive = false;
boolean isNullable = (columnDefinition.flags() & ColumnDefinition.ColumnDefinitionFlags.NOT_NULL_FLAG) == 0;
boolean isSigned = true;
int displaySize = (int) columnDefinition.columnLength();
resultSetBuilder.addColumnInfo(schemaName, tableName, columnName, columnType, precision, scale, columnLabel, isAutoIncrement, isCaseSensitive, isNullable, isSigned, displaySize);
} else {
resultSetBuilder.addColumnInfo(columnDescriptor.name(), columnDescriptor.jdbcType());
}
}
RowBaseIterator build = resultSetBuilder.build();
return build.getMetaData();
}
use of io.vertx.mysqlclient.impl.protocol.ColumnDefinition in project vertx-sql-client by eclipse-vertx.
the class MySQLRowImpl method getLocalTime.
@Override
public LocalTime getLocalTime(int pos) {
ColumnDefinition columnDefinition = rowDesc.columnDefinitions()[pos];
Object val = getValue(pos);
if (columnDefinition.type() == DataType.TIME && val instanceof Duration) {
// map MySQL TIME data type to java.time.LocalTime
Duration duration = (Duration) val;
return LocalTime.ofNanoOfDay(duration.toNanos());
} else {
return super.getLocalTime(pos);
}
}
Aggregations