cassandra_Cassandra_describe_keyspace_result::read PHP Метод

read() публичный Метод

public read ( $input )
    public function read($input)
    {
        $xfer = 0;
        $fname = null;
        $ftype = 0;
        $fid = 0;
        $xfer += $input->readStructBegin($fname);
        while (true) {
            $xfer += $input->readFieldBegin($fname, $ftype, $fid);
            if ($ftype == TType::STOP) {
                break;
            }
            switch ($fid) {
                case 0:
                    if ($ftype == TType::MAP) {
                        $this->success = array();
                        $_size159 = 0;
                        $_ktype160 = 0;
                        $_vtype161 = 0;
                        $xfer += $input->readMapBegin($_ktype160, $_vtype161, $_size159);
                        for ($_i163 = 0; $_i163 < $_size159; ++$_i163) {
                            $key164 = '';
                            $val165 = array();
                            $xfer += $input->readString($key164);
                            $val165 = array();
                            $_size166 = 0;
                            $_ktype167 = 0;
                            $_vtype168 = 0;
                            $xfer += $input->readMapBegin($_ktype167, $_vtype168, $_size166);
                            for ($_i170 = 0; $_i170 < $_size166; ++$_i170) {
                                $key171 = '';
                                $val172 = '';
                                $xfer += $input->readString($key171);
                                $xfer += $input->readString($val172);
                                $val165[$key171] = $val172;
                            }
                            $xfer += $input->readMapEnd();
                            $this->success[$key164] = $val165;
                        }
                        $xfer += $input->readMapEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 1:
                    if ($ftype == TType::STRUCT) {
                        $this->nfe = new cassandra_NotFoundException();
                        $xfer += $this->nfe->read($input);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                default:
                    $xfer += $input->skip($ftype);
                    break;
            }
            $xfer += $input->readFieldEnd();
        }
        $xfer += $input->readStructEnd();
        return $xfer;
    }

Usage Example

Пример #1
0
 public function recv_describe_keyspace()
 {
     $bin_accel = $this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED && function_exists('thrift_protocol_read_binary');
     if ($bin_accel) {
         $result = thrift_protocol_read_binary($this->input_, 'cassandra_Cassandra_describe_keyspace_result', $this->input_->isStrictRead());
     } else {
         $rseqid = 0;
         $fname = null;
         $mtype = 0;
         $this->input_->readMessageBegin($fname, $mtype, $rseqid);
         if ($mtype == TMessageType::EXCEPTION) {
             $x = new TApplicationException();
             $x->read($this->input_);
             $this->input_->readMessageEnd();
             throw $x;
         }
         $result = new cassandra_Cassandra_describe_keyspace_result();
         $result->read($this->input_);
         $this->input_->readMessageEnd();
     }
     if ($result->success !== null) {
         return $result->success;
     }
     if ($result->nfe !== null) {
         throw $result->nfe;
     }
     throw new Exception("describe_keyspace failed: unknown result");
 }
cassandra_Cassandra_describe_keyspace_result