Methods

StackDeck::Frame::Postgres

Public Class Methods

extract(ex, conn=nil) click to toggle source
# File lib/stackdeck/postgres.rb, line 44
def self.extract(ex, conn=nil)
  postgres_stack = []
  if ex.internal_query
    postgres_stack << Frame::SQL.from_char(ex.internal_query, ex.internal_position)
  end
  if ex.context
    postgres_stack.concat ex.context.split(/\n/).map {|s| parse(s, conn) }
  end
  if ex.query
    postgres_stack << Frame::SQL.from_char(ex.query, ex.query_position)
  end
end
parse(str, conn=nil) click to toggle source
# File lib/stackdeck/postgres.rb, line 57
def self.parse(str, conn=nil)
  if str =~ /([^"]+) "(.*)"(?: line (\d+))?(?: (at [^"]+))?$/
    case $1
    when 'SQL statement'
      Frame::SQL.new($2)
    else
      f = $1.empty? ? nil : $1
      self::Function.new(conn, f, $2, $3.to_i, $4)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.