Tablestore tablosuna tek bir satır veri yazmak için PHP SDK'nın putRow yöntemini çağırın.
Başlamadan önce
Yöntem açıklaması
public function putRow(array $request)
Örnek kod
Aşağıdaki örnek, birincil anahtar değeri row1 olan bir satırı test_table tablosuna yazar.
$request = array (
'table_name' => 'test_table',
// Build the primary key
'primary_key' => array (
array('id', 'row1')
)
);
try{
// Call putRow to write the row
$response = $client->putRow($request);
echo "* Read CU Cost: " . $response['consumed']['capacity_unit']['read'] . "\n";
echo "* Write CU Cost: " . $response['consumed']['capacity_unit']['write'] . "\n";
} catch (Exception $e) {
echo "Put Row failed.";
}
-
Öznitelik sütunu ekleyin.
$request['attribute_columns'] = array( array('col1', 'val1') ); -
Sürüm numarası belirtin. Her öznitelik sütunu için ayrı bir sürüm numarası atayın.
$request['attribute_columns'] = array( array('col1', 'val1', null, intval(microtime(true) * 1000)) );