case OChannelBinaryProtocol.REQUEST_COMMAND: {
data.commandInfo = "Execute remote command";
final boolean asynch = channel.readByte() == 'a';
final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(
connection.database, channel.readBytes());
final OQuery<?> query = (OQuery<?>) (command instanceof OQuery<?> ? command : null);
data.commandDetail = command.getText();
channel.acquireExclusiveLock();
try {
if (asynch) {
// ASYNCHRONOUS
final StringBuilder empty = new StringBuilder();
final Set<ODocument> recordsToSend = new HashSet<ODocument>();
final int txId = lastClientTxId;
final Map<String, Integer> fetchPlan = query != null ? OFetchHelper.buildFetchPlan(query.getFetchPlan()) : null;
command.setResultListener(new OCommandResultListener() {
@Override
public boolean result(final Object iRecord) {
if (empty.length() == 0)
try {
sendOk(txId);