On Thu, Jul 05, 2012 at 11:28:25AM -0700, Alex wrote: > I need to parse out where statements for sql in an app so that the fields > can be properly mapped to existing database columns and the statement > parameterized, etc. Can anyone suggest an existing node module to > accomplish this? Basically, if given a string such as: > > user.name = 'dsdsadadas' and (companyid = 1 or user.companyid = 2) and ( > true = user.isactive) > > I want to break it out into its expression counterparts and know that > user.name, companyid, user.isactive and user.companyid were all column > identifiers.
I've written an SQL parser in CoffeeScript for a relational database interface library project of mine, Relatable. You might be able to do something with that. https://github.com/bigeasy/relatable There's an SQL grammar for Peg JS. Haven't used it, but looks nifty. https://github.com/steveyen/sqld3 -- Alan Gutierrez - @bigeasy -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
