lib/heirloom/aws/simpledb.rb in heirloom-0.6.1 vs lib/heirloom/aws/simpledb.rb in heirloom-0.7.0rc1
- old
+ new
@@ -42,11 +42,16 @@
def delete(domain, key)
@sdb.delete_attributes domain, key
end
def count(domain)
- body = @sdb.select("SELECT count(*) FROM #{domain}").body
+ body = @sdb.select("SELECT count(*) FROM `#{domain}`").body
body['Items']['Domain']['Count'].first.to_i
+ end
+
+ def item_count(domain, item)
+ query = "SELECT count(*) FROM `#{domain}` WHERE itemName() = '#{item}'"
+ @sdb.select(query).body['Items']['Domain']['Count'].first.to_i
end
end
end