2016-09-30 23 views
0

AzureのPHP SDKを使用して、Azureテーブルストレージ内の既存のプロパティに値を追加したいとします。たとえば:エンティティのプロパティに値を追加するAzureテーブルのストレージ

PartitionKey: PartitionValue | RowKey: RowValue | PropertyValue -> Value1

私はこのようなValue1Value2を追加したい:

PartitionKey: PartitionValue | RowKey: RowValue | PropertyValue -> Value1:Value2

これは可能ですか? Azure SDK for PHPのinsertOrMergeエンティティで可能ですか?

答えて

0

updateEntity()を使用すると、テーブルストレージ内のエンティティのPropertyValueを更新できます。

E.G.

$tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString); 

try { 
    $result = $tableRestProxy->getEntity("{table}", "{PartitionKey}", "{RowKey}"); 
} 
catch(ServiceException $e){ 
    $code = $e->getCode(); 
    $error_message = $e->getMessage(); 
    echo $code.": ".$error_message."<br />"; 
} 

$entity = $result->getEntity(); 

$entity->setPropertyValue("{PropertyValue}",$entity->getPropertyValue("{PropertyValue}") . " append value"); 

try { 
    $tableRestProxy->updateEntity("{table}", $entity); 
} 
catch(ServiceException $e){ 
    $code = $e->getCode(); 
    $error_message = $e->getMessage(); 
    echo $code.": ".$error_message."<br />"; 
} 
関連する問題