OrientDB/Commands/OrientDBCommandAbstract.php
public function execute()
    {
        $this->socket->debug = $this->debug;
        $this->socket->send($this->requestBytes);

        if (is_null($this->parent->protocolVersion)) {
            $this->debugCommand('protocol_version');
            $serverProtocolVersion = $this->readShort();
            $this->parent->setProtocolVersion($serverProtocolVersion);
        }
        if ($this->opType == self::DB_CLOSE) {
            // No incoming bytes
            return null;
        }

        $this->debugCommand('request_status');
        $this->requestStatus = $this->readByte();

        $this->debugCommand('TransactionID');
        $requestTransactionID = $this->readInt();
        if ($requestTransactionID !== $this->currentTransactionID) {
            throw new OrientDBException('Transaction ID mismatch');
        }

        if ($this->requestStatus === chr(OrientDBCommandAbstract::STATUS_SUCCESS)) {
            $data = $this->parseResponse();
            if ($this->opType === self::DB_OPEN) {
                $this->parent->setSessionIDDB($this->sessionID);
            } elseif ($this->opType === self::CONNECT) {
                $this->parent->setSessionIDServer($this->sessionID);
            }
            return $data;
        } elseif ($this->requestStatus === chr(OrientDBCommandAbstract::STATUS_ERROR)) {
            $exception = null;
            while ($this->readByte() === chr(OrientDBCommandAbstract::STATUS_ERROR)) {
                $this->debugCommand('exception_javaclass');
                $javaException = $this->readString();
                $this->debugCommand('exception_message');
                $javaExceptionDescr = $this->readString();
                $exception = new OrientDBException($javaException . ': ' . $javaExceptionDescr, 0, is_null($exception) ? null : $exception);
            }
            throw $exception;
        } else {
            throw new OrientDBException('Unknown error');
        }
    }
public function execute()
    {
        $this->socket->debug = $this->debug;
        $this->socket->send($this->requestBytes);

        if (is_null($this->parent->protocolVersion)) {
            $this->debugCommand('protocol_version');
            $serverProtocolVersion = $this->readShort();
            $this->parent->setProtocolVersion($serverProtocolVersion);
        }
        if ($this->opType == self::DB_CLOSE) {
            // No incoming bytes
            return null;
        }

        $this->debugCommand('request_status');
        $this->requestStatus = $this->readByte();

        $this->debugCommand('TransactionID');
        $requestTransactionID = $this->readInt();
        if ($requestTransactionID !== $this->currentTransactionID) {
            throw new OrientDBException('Transaction ID mismatch');
        }

        if ($this->requestStatus === chr(OrientDBCommandAbstract::STATUS_SUCCESS)) {
            $data = $this->parseResponse();
            if ($this->opType === self::DB_OPEN) {
                $this->parent->setSessionIDDB($this->sessionID);
            } elseif ($this->opType === self::CONNECT) {
                $this->parent->setSessionIDServer($this->sessionID);
            }
            return $data;
        } elseif ($this->requestStatus === chr(OrientDBCommandAbstract::STATUS_ERROR)) {
            $exception = null;
            while ($this->readByte() === chr(OrientDBCommandAbstract::STATUS_ERROR)) {
                $this->debugCommand('exception_javaclass');
                $javaException = $this->readString();
                $this->debugCommand('exception_message');
                $javaExceptionDescr = $this->readString();
                $exception = new OrientDBException($javaException . ': ' . $javaExceptionDescr, 0, is_null($exception) ? null : $exception);
            }
            throw $exception;
        } else {
            throw new OrientDBException('Unknown error');
        }
    }
Execute command by sending data to server, receive initial reply
@throws null|OrientDBException
@throws OrientDBException
@return mixed