deleteAttributes:
Deletes one or more attributes associated with an item. If all attributes of the item are deleted, the item is deleted.
NOTE: If DeleteAttributes is called without being passed any attributes or values specified, 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 item data and uses an eventual consistency update model, performing a GetAttributes or Select operation (read) immediately after a DeleteAttributes or PutAttributes operation (write) might not return updated item data.
- (SimpleDBDeleteAttributesResponse *)deleteAttributes:(SimpleDBDeleteAttributesRequest *)deleteAttributesRequest
Parameters
- deleteAttributesRequest
- Container for the necessary parameters to execute the DeleteAttributes service method on AmazonSimpleDB.
Example
// Delete attributes of the specified item in the specified domain.
// If the attributes are not specified, it will delete the item in the domain.
//
+ (void)deleteAttributesWithDomainName:(NSString *)domainName
itemName:(NSString *)itemName
attributes:(NSArray *)attributes
{
// Start Network Activity Indicator.
//
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
// Construct request form.
//
SimpleDBDeleteAttributesRequest *deleteRequest = [[[SimpleDBDeleteAttributesRequest alloc] initWithDomainName:domainName andItemName:itemName] autorelease];
[deleteRequest setRequestEndpoint:AMAZON_SDB_US_EAST_1_ENDPOINT_SECURE];
if( attributes )
{
for(NSString *attrName in attributes )
[deleteRequest addAttribute:[[[SimpleDBAttribute alloc] initWithName:attrName andValue:nil] autorelease]];
}
// Do request delete.
//
SimpleDBDeleteAttributesResponse *deleteResponse = [[AmazonClientManager sdb] deleteAttributes:deleteRequest];
if( deleteResponse.error != nil )
{
NSLog(@"Error: %@", deleteResponse.error);
}
// Stop Network Activity Indicator.
//
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
// Return.
//
return;
}