}
@Override
public QueryResponse execute(Query query) throws ConnectionException {
String callMethod = null;
Response response;
if (query.isStreaming()) {
if (query.getKeyspaceIds() != null) {
callMethod = "VTGate.StreamExecuteKeyspaceIds";
} else {
callMethod = "VTGate.StreamExecuteKeyRanges";
}
response = streamCall(callMethod, Bsonify.queryToBson(query));
} else {
if (query.getKeyspaceIds() != null) {
callMethod = "VTGate.ExecuteKeyspaceIds";
} else {
callMethod = "VTGate.ExecuteKeyRanges";
}
response = call(callMethod, Bsonify.queryToBson(query));
}
return Bsonify.bsonToQueryResponse((BSONObject) response.getReply());
}