Deletes one or more attributes associated with the item. If all attributes of an item are deleted, the item is deleted.
If you specify DeleteAttributes without attributes or values, all the attributes for the item are deleted.
DeleteAttributes is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response.
Because Amazon SimpleDB makes multiple copies of your data and uses an eventual consistency update model, performing a GetAttributes or Select request (read) immediately after a DeleteAttributes or PutAttributes request (write) might not return the updated data.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the domain in which the attributes are being deleted. |
|
|
Required |
The name of the base item which will contain the series of keypairs. |
|
|
Optional |
Similar to columns on a spreadsheet, attributes represent categories of data that can be assigned to items. Takes an associative array of parameters that can have the following keys:
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Standard syntax for deleting all values under multiple Names.
// Instantiate $sdb = new AmazonSDB(); $response = $sdb->delete_attributes('example-domain', 'unit-test', array( array('Name' => 'key2'), array('Name' => 'key3') )); // Success? var_dump($response->isOK());Result:
bool(true)
Standard syntax for deleting specific Name-Value pairs, and all values under another Name.
// Instantiate $sdb = new AmazonSDB(); $response = $sdb->delete_attributes('example-domain', 'unit-test', array( array('Name' => 'key2', 'Value' => 'value1'), array('Name' => 'key2', 'Value' => 'value2'), array('Name' => 'key3') )); // Success? var_dump($response->isOK());Result:
bool(true)
Shorthand for deleting all values under a given Name.
// Instantiate $sdb = new AmazonSDB(); $response = $sdb->delete_attributes('example-domain', 'unit-test', array( 'Name' => 'key1' )); // Success? var_dump($response->isOK());Result:
bool(true)
Shorthand for deleting a specific value under a given Name.
// Instantiate $sdb = new AmazonSDB(); $response = $sdb->delete_attributes('example-domain', 'unit-test', array( 'Name' => 'key2', 'Value' => 'value1' )); // Success? var_dump($response->isOK());Result:
bool(true)
Standard syntax for deleting specific Name-Value pairs, and all values under another Name, provided conditions are met.
// Instantiate $sdb = new AmazonSDB(); $response = $sdb->delete_attributes('example-domain', 'unit-test', array( array('Name' => 'key2', 'Value' => 'value1'), array('Name' => 'key2', 'Value' => 'value2'), array('Name' => 'key3') ), array( 'Expected' => array( 'Name' => 'key99', 'Value' => 'value1', 'Exists' => 'true' ) )); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/sdb.class.php | Toggle source view (23 lines) | View on GitHub