aws 2.3.12 → 2.3.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sdb/active_sdb.rb +8 -5
- data/lib/sdb/right_sdb_interface.rb +13 -9
- metadata +4 -4
data/lib/sdb/active_sdb.rb
CHANGED
@@ -370,9 +370,9 @@ module Aws
|
|
370
370
|
options[:conditions] = build_conditions(options[:conditions])
|
371
371
|
# join ids condition and user defined conditions
|
372
372
|
options[:conditions] = options[:conditions].blank? ? ids_cond : "(#{options[:conditions]}) AND #{ids_cond}"
|
373
|
-
puts 'options=' + options.inspect
|
373
|
+
#puts 'options=' + options.inspect
|
374
374
|
result = sql_select(options)
|
375
|
-
puts 'select_from_ids result=' + result.inspect
|
375
|
+
#puts 'select_from_ids result=' + result.inspect
|
376
376
|
# if one record was requested then return it
|
377
377
|
unless bunch_of_records_requested
|
378
378
|
record = result[:items].first
|
@@ -397,9 +397,10 @@ module Aws
|
|
397
397
|
count = options[:count] || false
|
398
398
|
#puts 'count? ' + count.to_s
|
399
399
|
@next_token = options[:next_token]
|
400
|
+
@consistent_read = options[:consistent_read]
|
400
401
|
select_expression = build_select(options)
|
401
402
|
# request items
|
402
|
-
query_result = self.connection.select(select_expression, @next_token)
|
403
|
+
query_result = self.connection.select(select_expression, @next_token, @consistent_read)
|
403
404
|
# puts 'QR=' + query_result.inspect
|
404
405
|
ret = {}
|
405
406
|
if count
|
@@ -464,6 +465,7 @@ module Aws
|
|
464
465
|
#
|
465
466
|
def query(options) # :nodoc:
|
466
467
|
@next_token = options[:next_token]
|
468
|
+
@consistent_read = options[:consistent_read]
|
467
469
|
query_expression = build_conditions(options[:query_expression])
|
468
470
|
# add sort_options to the query_expression
|
469
471
|
if options[:sort_option]
|
@@ -482,7 +484,7 @@ module Aws
|
|
482
484
|
query_expression += sort_by_expression
|
483
485
|
end
|
484
486
|
# request items
|
485
|
-
query_result = self.connection.query(domain, query_expression, options[:max_number_of_items], @next_token)
|
487
|
+
query_result = self.connection.query(domain, query_expression, options[:max_number_of_items], @next_token, @consistent_read)
|
486
488
|
@next_token = query_result[:next_token]
|
487
489
|
items = query_result[:items].map do |name|
|
488
490
|
new_item = self.new('id' => name)
|
@@ -506,7 +508,8 @@ module Aws
|
|
506
508
|
records = query( :query_expression => options[:conditions],
|
507
509
|
:max_number_of_items => options[:limit],
|
508
510
|
:next_token => options[:next_token],
|
509
|
-
:sort_option => options[:sort] || options[:order]
|
511
|
+
:sort_option => options[:sort] || options[:order],
|
512
|
+
:consistent_read => options[:consistent_read] )
|
510
513
|
options[:auto_load] ? reload_all_records(records) : records
|
511
514
|
end
|
512
515
|
|
@@ -407,10 +407,11 @@ module Aws
|
|
407
407
|
#
|
408
408
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_GetAttributes.html
|
409
409
|
#
|
410
|
-
def get_attributes(domain_name, item_name, attribute_name=nil)
|
410
|
+
def get_attributes(domain_name, item_name, attribute_name=nil, consistent_read = nil)
|
411
411
|
link = generate_request("GetAttributes", 'DomainName' => domain_name,
|
412
|
-
'ItemName'
|
413
|
-
'AttributeName'
|
412
|
+
'ItemName' => item_name,
|
413
|
+
'AttributeName' => attribute_name,
|
414
|
+
'ConsistentRead' => consistent_read )
|
414
415
|
res = request_info(link, QSdbGetAttributesParser.new)
|
415
416
|
res[:attributes].each_value do |values|
|
416
417
|
values.collect! { |e| sdb_to_ruby(e) }
|
@@ -482,14 +483,15 @@ module Aws
|
|
482
483
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_Query.html
|
483
484
|
# http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?SortingData.html
|
484
485
|
#
|
485
|
-
def query(domain_name, query_expression = nil, max_number_of_items = nil, next_token = nil)
|
486
|
+
def query(domain_name, query_expression = nil, max_number_of_items = nil, next_token = nil, consistent_read = nil)
|
486
487
|
query_expression = query_expression_from_array(query_expression) if query_expression.is_a?(Array)
|
487
488
|
@last_query_expression = query_expression
|
488
489
|
#
|
489
490
|
request_params = { 'DomainName' => domain_name,
|
490
491
|
'QueryExpression' => query_expression,
|
491
492
|
'MaxNumberOfItems' => max_number_of_items,
|
492
|
-
'NextToken' => next_token
|
493
|
+
'NextToken' => next_token,
|
494
|
+
'ConsistentRead' => consistent_read }
|
493
495
|
link = generate_request("Query", request_params)
|
494
496
|
result = request_info( link, QSdbQueryParser.new )
|
495
497
|
# return result if no block given
|
@@ -550,7 +552,7 @@ module Aws
|
|
550
552
|
#
|
551
553
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?SDB_API_QueryWithAttributes.html
|
552
554
|
#
|
553
|
-
def query_with_attributes(domain_name, attributes=[], query_expression = nil, max_number_of_items = nil, next_token = nil)
|
555
|
+
def query_with_attributes(domain_name, attributes=[], query_expression = nil, max_number_of_items = nil, next_token = nil, consistent_read = nil)
|
554
556
|
attributes = attributes.to_a
|
555
557
|
query_expression = query_expression_from_array(query_expression) if query_expression.is_a?(Array)
|
556
558
|
@last_query_expression = query_expression
|
@@ -558,7 +560,8 @@ module Aws
|
|
558
560
|
request_params = { 'DomainName' => domain_name,
|
559
561
|
'QueryExpression' => query_expression,
|
560
562
|
'MaxNumberOfItems' => max_number_of_items,
|
561
|
-
'NextToken' => next_token
|
563
|
+
'NextToken' => next_token,
|
564
|
+
'ConsistentRead' => consistent_read }
|
562
565
|
attributes.each_with_index do |attribute, idx|
|
563
566
|
request_params["AttributeName.#{idx+1}"] = attribute
|
564
567
|
end
|
@@ -616,12 +619,13 @@ module Aws
|
|
616
619
|
# http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?UsingSelect.html
|
617
620
|
# http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?SDBLimits.html
|
618
621
|
#
|
619
|
-
def select(select_expression, next_token = nil)
|
622
|
+
def select(select_expression, next_token = nil, consistent_read = nil)
|
620
623
|
select_expression = query_expression_from_array(select_expression) if select_expression.is_a?(Array)
|
621
624
|
@last_query_expression = select_expression
|
622
625
|
#
|
623
626
|
request_params = { 'SelectExpression' => select_expression,
|
624
|
-
'NextToken' => next_token
|
627
|
+
'NextToken' => next_token,
|
628
|
+
'ConsistentRead' => consistent_read }
|
625
629
|
link = generate_request("Select", request_params)
|
626
630
|
result = select_response_to_ruby(request_info( link, QSdbSelectParser.new ))
|
627
631
|
return result unless block_given?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 13
|
10
|
+
version: 2.3.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Travis Reeder
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-06-
|
20
|
+
date: 2010-06-25 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|