|
@@ -18,7 +18,7 @@ class PgDb
|
|
|
attr_reader :connection
|
|
attr_reader :connection
|
|
|
|
|
|
|
|
def initialize(connection_string = nil, max_connections = 512)
|
|
def initialize(connection_string = nil, max_connections = 512)
|
|
|
- @connection = Sequel.connect(connection_string, max_connections: max_connections, sql_log_level: :warning)
|
|
|
|
|
|
|
+ @connection = Sequel.connect(connection_string, max_connections: max_connections)
|
|
|
Sequel.extension :fiber_concurrency if defined?(Falcon)
|
|
Sequel.extension :fiber_concurrency if defined?(Falcon)
|
|
|
|
|
|
|
|
prepare_statements
|
|
prepare_statements
|
|
@@ -53,13 +53,6 @@ class PgDb
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- def select_random_numbers(count)
|
|
|
|
|
- count = validate_count(count)
|
|
|
|
|
- ALL_IDS.sample(count).map do |id|
|
|
|
|
|
- @world_random_select.call(randomvalue: random_id, id: id).first
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
def select_worlds(count)
|
|
def select_worlds(count)
|
|
|
count = validate_count(count)
|
|
count = validate_count(count)
|
|
|
ALL_IDS.sample(count).map do |id|
|
|
ALL_IDS.sample(count).map do |id|
|
|
@@ -78,8 +71,7 @@ class PgDb
|
|
|
else
|
|
else
|
|
|
select_worlds(count)
|
|
select_worlds(count)
|
|
|
end
|
|
end
|
|
|
- #values = []
|
|
|
|
|
- ids=[]
|
|
|
|
|
|
|
+ ids = []
|
|
|
sql = String.new("UPDATE world SET randomnumber = CASE id ")
|
|
sql = String.new("UPDATE world SET randomnumber = CASE id ")
|
|
|
results.each do |r|
|
|
results.each do |r|
|
|
|
r[:randomnumber] = random_id
|
|
r[:randomnumber] = random_id
|