Module: TestChamber
Defined Under Namespace
Modules: Helpers
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#parse(sql, output_errors = true) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/test_chamber.rb', line 19 def parse(sql, output_errors = true) parser = ::VSqlParser.parser VSqlParser.parse(sql).tap do |tree| # If the AST is nil then there was an error during parsing # we need to report a simple error message to help the user if tree.nil? output_error(sql, parser) if output_errors raise Exception, parser.failure_reason end end end |
#pparse(sql, output_errors = true) ⇒ Object
15 16 17 |
# File 'lib/test_chamber.rb', line 15 def pparse(sql, output_errors = true) parse(sql, output_errors).tap { |q| q.prune! } end |