Class: PGContextLine
Overview
Contexts
Constant Summary collapse
- SQL_STATEMENT =
/^SQL statement "/
- SQL_FUNCTION =
/([^\s]+)[\s]+function[\s]+"([^"]+)"(.*)$/
Constants inherited from PGLogLine
Instance Attribute Summary
Attributes inherited from PGLogLine
#cmd_no, #connection_id, #duration, #ignore, #line_no, #text
Instance Method Summary collapse
- #append_to(queries) ⇒ Object
-
#initialize(text) ⇒ PGContextLine
constructor
A new instance of PGContextLine.
Methods inherited from PGLogLine
Constructor Details
#initialize(text) ⇒ PGContextLine
Returns a new instance of PGContextLine.
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/pqa.rb', line 368 def initialize(text) statement_match = SQL_STATEMENT.match(text) if statement_match super(statement_match.post_match[0..-1]) else function_match = SQL_FUNCTION.match(text) if function_match super(function_match[2]) else $stderr.puts "Unrecognized Context" if DEBUG super(text) end @match_all = true end end |
Instance Method Details
#append_to(queries) ⇒ Object
384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/pqa.rb', line 384 def append_to(queries) sub_query = queries.pop if sub_query.nil? $stderr.puts "Missing Query for Context" elsif queries.last queries.last.set_subquery(sub_query.to_s) else $stderr.puts "Context for no previous Query" end return nil end |