Пример #1
0
 /**
  * Creates a new Table instance
  *
  * @param string                          $host            Storage host name
  * @param string                          $accountName     Account name for Windows Azure
  * @param string                          $accountKey      Account key for Windows Azure
  * @param boolean                         $usePathStyleUri Use path-style URI's
  * @param RetryPolicy\AbstractRetryPolicy $retryPolicy     Retry policy to use when making requests
  */
 public function __construct($host = Storage::URL_DEV_TABLE, $accountName = Credentials\AbstractCredentials::DEVSTORE_ACCOUNT, $accountKey = Credentials\AbstractCredentials::DEVSTORE_KEY, $usePathStyleUri = false, RetryPolicy\AbstractRetryPolicy $retryPolicy = null)
 {
     parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
     // Always use SharedKeyLite authentication
     $this->_credentials = new Credentials\SharedKeyLite($accountName, $accountKey, $this->_usePathStyleUri);
     // API version
     $this->_apiVersion = '2009-04-14';
 }
Пример #2
0
 /**
  * Commit current batch
  *
  * @throws RuntimeException
  * @return Response
  */
 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 RuntimeException('An error has occured while committing a batch: ' . $errors[2][0]);
     }
     // Return
     return $response;
 }