Class: PGQueryStarterWithDuration

Inherits:
PGQueryStarter show all
Defined in:
lib/pqa.rb

Constant Summary

Constants inherited from PGLogLine

PGLogLine::DEBUG

Instance Attribute Summary

Attributes inherited from PGQueryStarter

#ignore

Attributes inherited from PGLogLine

#cmd_no, #connection_id, #duration, #ignore, #line_no, #text

Instance Method Summary collapse

Methods inherited from PGQueryStarter

#filter_query

Methods inherited from PGLogLine

#dump, #parse_duration, #to_s

Constructor Details

#initialize(text, time_str, unit) ⇒ PGQueryStarterWithDuration

Returns a new instance of PGQueryStarterWithDuration.



237
238
239
240
241
242
243
244
245
246
247
# File 'lib/pqa.rb', line 237

def initialize(text, time_str, unit)
  @time_str = time_str
  @unit = unit
  text_match = /[\s]*(query|statement):[\s]*/i.match(text)
  if text_match
    super(text_match.post_match, parse_duration(time_str, unit))
  else
    $stderr.puts "Found garbage after Duration line : #{text}"
    super(text, parse_duration(time_str, unit))
  end
end

Instance Method Details

#append_to(queries) ⇒ Object



249
250
251
252
253
254
255
256
# File 'lib/pqa.rb', line 249

def append_to(queries)
  queries.got_duration!
  closed_query = queries.pop
  query = Query.new(@text, @ignore)
  query.duration = @duration
  queries.push(query)
  return closed_query
end