processResponse method
Parses the response
containing the response to the command.
Returns a HandlerResponse.
The default implementation returns a finished HandlerResponse with a result which is obtained by calling checkResponse.
Implementation
HandlerResponse processResponse(ReadBuffer response) {
var packet = checkResponse(response, true);
if (packet == null) {
if (_parametersToRead > -1) {
if (response[0] == PACKET_EOF) {
if (_parametersToRead != 0) {
throw MySqlProtocolError("Unexpected EOF packet; was expecting another $_parametersToRead parameter(s)");
}
} else {
var fieldPacket = Field.fromBuffer(response);
_parameters![_okPacket!.parameterCount - _parametersToRead] = fieldPacket;
}
_parametersToRead--;
} else if (_columnsToRead > -1) {
if (response[0] == PACKET_EOF) {
if (_columnsToRead != 0) {
throw MySqlProtocolError("Unexpected EOF packet; was expecting another $_columnsToRead column(s)");
}
} else {
var fieldPacket = Field.fromBuffer(response);
_columns![_okPacket!.columnCount - _columnsToRead] = fieldPacket;
}
_columnsToRead--;
}
} else if (packet is PrepareOkPacket) {
_okPacket = packet;
_parametersToRead = packet.parameterCount;
_columnsToRead = packet.columnCount;
_parameters = List<Field?>.filled(_parametersToRead, null, growable: false);
_columns = List<Field?>.filled(_columnsToRead, null, growable: false);
if (_parametersToRead == 0) {
_parametersToRead = -1;
}
if (_columnsToRead == 0) {
_columnsToRead = -1;
}
}
if (_parametersToRead == -1 && _columnsToRead == -1) {
return HandlerResponse(result: PreparedQuery(this));
}
return HandlerResponse();
}