Example #1
0
 /**
  * Write bytes to the socket.
  *
  * @param string $value
  */
 protected function _writeBytes($value)
 {
     $this->_writeStack[] = Writer::packBytes($value);
 }
Example #2
0
 /**
  * Write the data to the socket.
  */
 protected function _write()
 {
     if (array_search($this->command, [Constants::QUERY_CMD, Constants::QUERY_SYNC, Constants::QUERY_GREMLIN, Constants::QUERY_SCRIPT]) !== false) {
         $this->_mod_byte = 's';
         # synchronous
     } else {
         $this->_mod_byte = 'a';
         # asynchronous
     }
     $this->_writeChar($this->_mod_byte);
     $_payload = [];
     $_payload[] = Writer::packString($this->command);
     if ($this->command == Constants::QUERY_SCRIPT) {
         $_payload[] = Writer::packString('sql');
     }
     $_payload[] = Writer::packString($this->query);
     if (array_search($this->command, [Constants::QUERY_ASYNC, Constants::QUERY_SYNC, Constants::QUERY_GREMLIN]) !== false) {
         $_payload[] = Writer::packInt($this->limit);
         $_payload[] = Writer::packString($this->fetch_plan);
     }
     $_payload[] = Writer::packInt(0);
     $this->_writeString(implode("", $_payload));
 }