Example #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;
 }
Example #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;
 }
Example #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);
     }
 }
Example #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);
}