Module: Insight::Database::RequestDataClient

Included in:
Panel, SpeedTracer::TraceApp
Defined in:
lib/insight/database.rb

Instance Method Summary collapse

Instance Method Details

#key_sql_template(sql) ⇒ Object



8
9
10
# File 'lib/insight/database.rb', line 8

def key_sql_template(sql)
  @key_sql_template = sql
end

#retrieve(request_id) ⇒ Object Also known as: retreive



30
31
32
# File 'lib/insight/database.rb', line 30

def retrieve(request_id)
  @table.for_request(request_id)
end

#store(env, *keys_and_value) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/insight/database.rb', line 19

def store(env, *keys_and_value)
  return if env.nil?
  request_id = env["insight.request-id"]
  return if request_id.nil?

  value = keys_and_value[-1]
  keys = keys_and_value[0...-1]

  @table.store(request_id, value, @key_sql_template % keys)
end

#table_lengthObject



35
36
37
# File 'lib/insight/database.rb', line 35

def table_length
  @table.length
end

#table_setup(name, *keys) ⇒ Object



12
13
14
15
16
17
# File 'lib/insight/database.rb', line 12

def table_setup(name, *keys)
  @table = DataTable.new(name, *keys)
  if keys.empty?
    @key_sql_template = ""
  end
end