/** * Prepare command execution * @throws OrientDBWrongCommandException */ public function prepare() { $this->addByte(chr($this->opType)); if ($this->opType === self::DB_OPEN || $this->opType === self::CONNECT) { $this->currentTransactionID = -++self::$transactionID; } else { if (in_array($this->opType, $this->parent->getCommandsRequiresConnect())) { $this->currentTransactionID = $this->parent->getSessionIDServer(); } elseif (in_array($this->opType, $this->parent->getCommandsRequiresDBOpen())) { $this->currentTransactionID = $this->parent->getSessionIDDB(); } else { throw new OrientDBWrongCommandException('Unknown command'); } } $this->addInt($this->currentTransactionID); }