appoxy-aws 1.11.25 → 1.11.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +4 -0
  2. data/lib/sdb/active_sdb.rb +13 -1
  3. metadata +2 -2
@@ -7,6 +7,10 @@ This is a forked version of RightScale's AWS library and we forked it because:
7
7
  1. RightScale doesn't have the source hosted for the community
8
8
  1. We needed fixes and changes for [http://code.google.com/p/simple-record/ SimpleRecord] and didn't want to wait for RightScale to do it.
9
9
 
10
+ = Discussion Group
11
+
12
+ http://groups.google.com/group/ruby-aws
13
+
10
14
  = RightScale Amazon Web Services Ruby Gems
11
15
 
12
16
  Published by RightScale, Inc. under the MIT License.
@@ -330,6 +330,10 @@ module RightAws
330
330
  sql_select(options)
331
331
  when :first then
332
332
  sql_select(options.merge(:limit => 1)).first
333
+ when :count then
334
+ res = sql_select(options.merge(:count => true))
335
+ puts 'res=' + res.inspect
336
+ res
333
337
  else
334
338
  select_from_ids args, options
335
339
  end
@@ -375,10 +379,16 @@ module RightAws
375
379
  end
376
380
 
377
381
  def sql_select(options) # :nodoc:
382
+ count = options[:count] || false
383
+ #puts 'count? ' + count.to_s
378
384
  @next_token = options[:next_token]
379
385
  select_expression = build_select(options)
380
386
  # request items
381
387
  query_result = self.connection.select(select_expression, @next_token)
388
+ #puts 'QR=' + query_result.inspect
389
+ if count
390
+ return query_result[:items][0]["Domain"]["Count"][0].to_i
391
+ end
382
392
  @next_token = query_result[:next_token]
383
393
  items = query_result[:items].map do |hash|
384
394
  id, attributes = hash.shift
@@ -551,6 +561,8 @@ module RightAws
551
561
 
552
562
  def build_select(options) # :nodoc:
553
563
  select = options[:select] || '*'
564
+ select = options[:count] ? "count(*)" : select
565
+ #puts 'select=' + select.to_s
554
566
  from = options[:from] || domain
555
567
  conditions = options[:conditions] ? " WHERE #{build_conditions(options[:conditions])}" : ''
556
568
  order = options[:order] ? " ORDER BY #{options[:order]}" : ''
@@ -935,4 +947,4 @@ module RightAws
935
947
  end
936
948
  end
937
949
  end
938
- end
950
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.25
4
+ version: 1.11.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-07-28 00:00:00 -07:00
13
+ date: 2009-07-31 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16