From 673c5a1407e46741aee1b92a75c781cfb327d474 Mon Sep 17 00:00:00 2001 From: Travis Reeder Date: Wed, 22 Dec 2010 14:08:25 -0800 Subject: [PATCH] Added options to batch_put_attributes --- lib/sdb/right_sdb_interface.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/sdb/right_sdb_interface.rb b/lib/sdb/right_sdb_interface.rb index 9d44106..14f5223 100644 --- a/lib/sdb/right_sdb_interface.rb +++ b/lib/sdb/right_sdb_interface.rb @@ -389,7 +389,7 @@ def create_domain_if_not_exist(ex, domain_name) # # items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true) - def batch_put_attributes(domain_name, items) + def batch_put_attributes(domain_name, items, options={}) params = {'DomainName' => domain_name} i = 0 items.each do |item| @@ -399,7 +399,17 @@ def batch_put_attributes(domain_name, items) i += 1 end link = generate_request("BatchPutAttributes", params) - request_info(link, QSdbSimpleParser.new) + begin + request_info(link, QSdbSimpleParser.new, options) + rescue Aws::AwsError => ex + # puts "RESCUED in batch_put_attributes: " + $! + if options[:create_domain] && create_domain_if_not_exist(ex, domain_name) + options.delete(:create_domain) + batch_put_attributes(domain_name, items, options) + else + raise ex + end + end rescue Exception on_exception end