Exemple #1
0
 /**
  * 
  * @param string $queryId
  * @param array $values
  * @return self
  */
 public function appendQueryId($queryId, array $values = [])
 {
     $binary = pack('C', 1);
     $binary .= pack('n', strlen($queryId)) . $queryId;
     $binary .= Request::valuesBinary($values, !empty($this->_options['names_for_values']));
     $this->_queryArray[] = $binary;
     return $this;
 }
Exemple #2
0
 /**
  * 
  * @param string $queryId
  * @param array $values
  * @return self
  */
 public function appendQueryId($queryId, array $values = [])
 {
     $binary = pack('C', 1);
     $binary .= pack('n', strlen($queryId)) . $queryId;
     $binary .= Request::valuesBinary($values);
     $this->_queryArray[] = $binary;
     return $this;
 }
 /**
  * 
  * @param int $consistency
  * @param array $values
  * @param array $options
  * @return string
  */
 public static function queryParameters($consistency, array $values = [], array $options = [])
 {
     $flags = 0;
     $optional = '';
     if (!empty($values)) {
         $flags |= Query::FLAG_VALUES;
         $optional .= Request::valuesBinary($values, !empty($options['names_for_values']));
     }
     if (!empty($options['skip_metadata'])) {
         $flags |= Query::FLAG_SKIP_METADATA;
     }
     if (isset($options['page_size'])) {
         $flags |= Query::FLAG_PAGE_SIZE;
         $optional .= pack('N', $options['page_size']);
     }
     if (isset($options['paging_state'])) {
         $flags |= Query::FLAG_WITH_PAGING_STATE;
         $optional .= pack('N', strlen($options['paging_state'])) . $options['paging_state'];
     }
     if (isset($options['serial_consistency'])) {
         $flags |= Query::FLAG_WITH_SERIAL_CONSISTENCY;
         $optional .= pack('n', $options['serial_consistency']);
     }
     if (isset($options['default_timestamp'])) {
         $flags |= Query::FLAG_WITH_DEFAULT_TIMESTAMP;
         $bigint = new Type\Bigint($options['default_timestamp']);
         $optional .= $bigint->getBinary();
     }
     if (!empty($options['names_for_values'])) {
         $flags |= Query::FLAG_WITH_NAMES_FOR_VALUES;
     }
     return pack('n', $consistency) . pack('C', $flags) . $optional;
 }