./lib/sdb_dal/repository.rb in sdb_dal-0.0.5 vs ./lib/sdb_dal/repository.rb in sdb_dal-0.0.6
- old
+ new
@@ -1,10 +1,9 @@
module SdbDal
$KCODE = 'u'
require "aws_sdb"
require "sdb_dal/storage.rb"
- require 'ya2yaml'
require File.dirname(__FILE__) +"/memory_repository.rb"
require File.dirname(__FILE__) +"/domain_object_cache_item.rb"
require File.dirname(__FILE__) +"/sdb_monkey_patch.rb"
class Repository
@@ -34,11 +33,10 @@
@logger = options[:logger]
if !@logger
@logger = Logger.new(STDOUT)
@logger.level = Logger::ERROR
end
-
@sdb=AwsSdb::Service.new(:access_key_id=>aws_key_id,:secret_access_key=>aws_secret_key,:url=>"http://sdb.amazonaws.com",:logger=>@logger)
@session_cache=MemoryRepository.new
# #create_domain()
end
@@ -129,11 +127,11 @@
return
rescue Exception => e
s= "#{e.message}\n#{e.backtrace}"
@logger.warn(s) if @logger
-
+ puts e.to_yaml
sleep(i*i)
end
end
end
@@ -199,14 +197,10 @@
end
if value.respond_to?(:greater_than_or_equal_to) && value.greater_than_or_equal_to
got_something=true
extend_query(query," ['#{key}' >= '#{escape_quotes(attribute_descriptions[key].format_for_sdb_single( value.greater_than_or_equal_to))}']")
end
- if value==false
- got_something=true
- extend_query(query," ['#{key}' != 'true' ]")
- end
if !got_something
extend_query(query," ['#{key}' = '#{escape_quotes( attribute_descriptions[key].format_for_sdb_single(value))}']")
end
else
# #it must be formatted already. likely an index
@@ -364,11 +358,11 @@
end
def sdb_query_with_attributes(table_name,query,max,token=nil)
@logger.debug( "SDB query:#{table_name}(#{max}) : #{query} #{token}" ) if @logger
- puts "#{table_name} #{query} (#{max}) #{token}"
+# puts "#{table_name} #{query} (#{max}) #{token}"
20.times do |i|
begin
return @sdb.query_with_attributes(make_domain_name(table_name),query,max,token)
rescue Exception => e
@@ -414,6 +408,6 @@
def clear
@session_cache.clear
end
end
-end
\ No newline at end of file
+end