Anyone know of a Ruby SQL parser?
Anyone 开发者_StackOverflow社区know of a Ruby SQL parser?
Here's an example of a SQL parser done with rparsec:
http://docs.codehaus.org/display/JPARSEC/SQL+parser+in+rparsec
this is the svn tree for a sql parser based on Treetop
I post answer here for someone who will need. I found this gem 'sql-parser'
gem install sql-parser
However this gem is not up-to-date if you install with command 'gem install'. So we have to check out the code from github also to get latest version. When I try to parse an insert statement after gem install. It failed.
After updating code from github. it can parse.
Github https://github.com/cryodex/sql-parser
Try the gda gem by tenderlove.
RubyGems: https://rubygems.org/gems/gda
Github: https://github.com/tenderlove/gda/
精彩评论