Exemplo n.º 1
0
 /**
  * Commit current batch
  *
  * @return Microsoft_Http_Response
  * @throws Microsoft_WindowsAzure_Exception
  */
 public function commit()
 {
     // Perform batch
     $response = $this->_storageClient->performBatch($this->_operations, $this->_forTableStorage, $this->_isSingleSelect);
     // Dispose
     $this->_clean();
     // Parse response
     $errors = null;
     preg_match_all('/<message (.*)>(.*)<\\/message>/', $response->getBody(), $errors);
     // Error?
     if (count($errors[2]) > 0) {
         throw new Microsoft_WindowsAzure_Exception('An error has occured while committing a batch: ' . $errors[2][0]);
     }
     // Return
     return $response;
 }
Exemplo n.º 2
0
 /**
  * Perform request using Microsoft_Http_Client channel
  *
  * @param string $path Path
  * @param string $queryString Query string
  * @param string $httpVerb HTTP verb the request will use
  * @param array $headers x-ms headers to add
  * @param boolean $forTableStorage Is the request for table storage?
  * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
  * @param string $resourceType Resource type
  * @param string $requiredPermission Required permission
  * @return Microsoft_Http_Response
  */
 protected function _performRequest($path = '/', $queryString = '', $httpVerb = Microsoft_Http_Client::GET, $headers = array(), $forTableStorage = false, $rawData = null, $resourceType = Microsoft_WindowsAzure_Storage::RESOURCE_UNKNOWN, $requiredPermission = Microsoft_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ)
 {
     // Add headers
     $headers['DataServiceVersion'] = '1.0;NetFx';
     $headers['MaxDataServiceVersion'] = '1.0;NetFx';
     // Perform request
     return parent::_performRequest($path, $queryString, $httpVerb, $headers, $forTableStorage, $rawData, $resourceType, $requiredPermission);
 }