use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class SendMakeHandler method fieldEofResponse.
@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, BackendConnection conn) {
lock.lock();
try {
if (terminate.get())
return;
this.fieldPackets = fieldPackets;
this.sourceFields = HandlerTool.createFields(this.fieldPackets);
for (Item sel : selects) {
Item tmpItem = HandlerTool.createItem(sel, this.sourceFields, 0, isAllPushDown(), type());
tmpItem.setItemName(sel.getItemName());
String selAlias = sel.getAlias();
if (selAlias != null || tableAlias != null) {
// remove the added tmp FNAF
if (StringUtils.indexOf(selAlias, Item.FNAF) == 0)
selAlias = StringUtils.substring(selAlias, Item.FNAF.length());
}
tmpItem = HandlerTool.createRefItem(tmpItem, schema, table, tableAlias, selAlias);
this.selItems.add(tmpItem);
}
List<FieldPacket> newFieldPackets = new ArrayList<>();
for (Item selItem : this.selItems) {
FieldPacket tmpFp = new FieldPacket();
selItem.makeField(tmpFp);
/* Keep things compatible for old clients */
if (tmpFp.getType() == FieldTypes.MYSQL_TYPE_VARCHAR.numberValue())
tmpFp.setType(FieldTypes.MYSQL_TYPE_VAR_STRING.numberValue());
newFieldPackets.add(tmpFp);
}
nextHandler.fieldEofResponse(null, null, newFieldPackets, null, this.isLeft, conn);
} finally {
lock.unlock();
}
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class UnionHandler method unionFieldPackets.
/**
* merge field packets with field packets2
* eg: int field union double field ->double field
*
* @param fieldPackets fieldPackets
* @param fieldPackets2 fieldPackets2
*/
private List<FieldPacket> unionFieldPackets(List<FieldPacket> fieldPackets, List<FieldPacket> fieldPackets2) {
List<FieldPacket> newFps = new ArrayList<>();
for (int i = 0; i < fieldPackets.size(); i++) {
FieldPacket fp1 = fieldPackets.get(i);
FieldPacket fp2 = fieldPackets2.get(i);
FieldPacket newFp = unionFieldPacket(fp1, fp2);
newFps.add(newFp);
}
return newFps;
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class UnionHandler method checkFieldPackets.
private void checkFieldPackets() {
for (int i = 0; i < selects.size(); i++) {
FieldPacket fp = this.fieldPackets.get(i);
Item sel = selects.get(i);
fp.setName(sel.getItemName().getBytes());
fp.setDb(null);
fp.setTable(null);
fp.setOrgTable(null);
}
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class DirectGroupByHandler method sendGroupFieldPackets.
/**
* aggregate functions result and origin rowdatapacket
*/
private List<FieldPacket> sendGroupFieldPackets(MySQLConnection conn) {
List<FieldPacket> newFps = new ArrayList<>();
for (ItemSum sum1 : sums) {
Item sum = sum1;
FieldPacket tmp = new FieldPacket();
sum.makeField(tmp);
newFps.add(tmp);
}
newFps.addAll(this.fieldPackets);
nextHandler.fieldEofResponse(null, null, newFps, null, this.isLeft, conn);
return newFps;
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class OrderedGroupByHandler method sendGroupFieldPackets.
/**
* new fieldPackets: generated function result + origin fieldpackets
*/
private void sendGroupFieldPackets(BackendConnection conn) {
List<FieldPacket> newFps = new ArrayList<>();
for (ItemSum sum1 : sums) {
Item sum = sum1;
FieldPacket tmp = new FieldPacket();
sum.makeField(tmp);
newFps.add(tmp);
}
newFps.addAll(this.fieldPackets);
nextHandler.fieldEofResponse(null, null, newFps, null, this.isLeft, conn);
}
Aggregations