use of com.mysql.cj.protocol.x.FetchDoneEntity in project aws-mysql-jdbc by awslabs.
the class SqlResultBuilder method addProtocolEntity.
@Override
public boolean addProtocolEntity(ProtocolEntity entity) {
if (entity instanceof Field) {
this.fields.add((Field) entity);
if (!this.isRowResult) {
this.isRowResult = true;
}
this.prevEntity = entity;
return false;
} else if (entity instanceof Notice) {
this.statementExecuteOkBuilder.addProtocolEntity(entity);
return false;
}
if (this.isRowResult && this.metadata == null) {
this.metadata = new DefaultColumnDefinition(this.fields.toArray(new Field[] {}));
}
if (entity instanceof Row) {
this.rows.add(((Row) entity).setMetadata(this.metadata));
} else if (entity instanceof FetchDoneMoreResults) {
this.resultSets.add(new SqlSingleResult(this.metadata, this.defaultTimeZone, new BufferedRowList(this.rows), () -> this.statementExecuteOkBuilder.build(), this.pset));
// clear variables to accept next result set
this.fields = new ArrayList<>();
this.metadata = null;
this.rows = new ArrayList<>();
this.statementExecuteOkBuilder = new StatementExecuteOkBuilder();
} else if (entity instanceof FetchDoneEntity) {
if (this.prevEntity instanceof FetchDoneMoreResults) {
// no-op, possibly bug in xplugin sending FetchDone immediately following FetchDoneMoreResultsets
} else {
this.resultSets.add(new SqlSingleResult(this.metadata, this.defaultTimeZone, new BufferedRowList(this.rows), () -> this.statementExecuteOkBuilder.build(), this.pset));
}
} else if (entity instanceof StatementExecuteOk) {
return true;
}
this.prevEntity = entity;
return false;
}
Aggregations