Example #1
0
 /**
  * Apply a mutation to the Datastore (commit)
  *
  * @param \Google_Service_Datastore_Mutation $obj_mutation
  * @return \Google_Service_Datastore_CommitResponse
  */
 private function commitMutation(\Google_Service_Datastore_Mutation $obj_mutation)
 {
     $obj_request = new \Google_Service_Datastore_CommitRequest();
     if (null === $this->str_next_transaction) {
         $obj_request->setMode('NON_TRANSACTIONAL');
     } else {
         $obj_request->setMode('TRANSACTIONAL');
         $obj_request->setTransaction($this->str_next_transaction);
         $this->str_next_transaction = null;
     }
     $obj_request->setMutation($obj_mutation);
     $this->obj_last_response = $this->obj_datasets->commit($this->str_dataset_id, $obj_request);
     return $this->obj_last_response;
 }
 /**
  * Apply a mutation to the Datastore (commit)
  *
  * @param \Google_Service_Datastore_Mutation $obj_mutation
  * @return \Google_Service_Datastore_CommitResponse
  * @throws Contention
  * @throws \Google_Service_Exception
  */
 private function commitMutation(\Google_Service_Datastore_Mutation $obj_mutation)
 {
     $obj_request = new \Google_Service_Datastore_CommitRequest();
     if (null === $this->str_next_transaction) {
         $obj_request->setMode('NON_TRANSACTIONAL');
     } else {
         $obj_request->setMode('TRANSACTIONAL');
         $obj_request->setTransaction($this->str_next_transaction);
         $this->str_next_transaction = NULL;
     }
     $obj_request->setMutation($obj_mutation);
     try {
         $this->obj_last_response = $this->obj_datasets->commit($this->str_dataset_id, $obj_request);
     } catch (\Google_Service_Exception $obj_exception) {
         $this->obj_last_response = NULL;
         if (409 == $obj_exception->getCode()) {
             throw new Contention('Datastore contention', 409, $obj_exception);
         } else {
             throw $obj_exception;
         }
     }
 }