示例#1
0
 public static function decodeServerResponse($json)
 {
     $jsonArray = array_values((array) $json);
     foreach ($jsonArray as &$val) {
         $val = DatumConverter::decodedJSONToDatum($val);
         unset($val);
     }
     $result = new ArrayDatum();
     $result->setValue($jsonArray);
     return $result;
 }
示例#2
0
 public static function decodeServerResponse($json)
 {
     $jsonObject = (array) $json;
     foreach ($jsonObject as $key => &$val) {
         $val = DatumConverter::decodedJSONToDatum($val);
         unset($val);
     }
     $result = new ObjectDatum();
     $result->setValue($jsonObject);
     return $result;
 }
示例#3
0
 private function setBatch($response)
 {
     $dc = new DatumConverter();
     $this->isComplete = $response['t'] == ResponseResponseType::PB_SUCCESS_SEQUENCE;
     $this->currentIndex = 0;
     $this->currentSize = \count($response['r']);
     $this->currentData = array();
     foreach ($response['r'] as $row) {
         $this->currentData[] = $datum = $dc->decodedJSONToDatum($row);
     }
 }
示例#4
0
function binary($str)
{
    $encodedStr = base64_encode($str);
    if ($encodedStr === false) {
        throw new RqlDriverError("Failed to Base64 encode '" . $str . "'");
    }
    $pseudo = array('$reql_type$' => 'BINARY', 'data' => $encodedStr);
    $dc = new DatumConverter();
    return $dc->nativeToDatum($pseudo);
}