Re: [nodejs] Parse an SQL query into a JavaScript object

2014-07-17 Thread Simon
What about this: https://github.com/dsferruzza/simpleSqlParser I've come across a few in the past but they're often not feature-complete and can't parse JOIN and subqueries and such. I think one of the use cases I've seen was to polyfill WebSQL by using IndexedDB in the browser, but I can't fin

Re: [nodejs] Parse an SQL query into a JavaScript object

2014-07-16 Thread João Rodrigues
Terça-feira, 15 de Julho de 2014 19:35:13 UTC+1, Matt Sergeant escreveu: > You'll need to write a parser. There are tools to help, e.g. > http://pegjs.majda.cz/documentation > Hi Matt. I was already writing the parser with JISON , but I'm glad you answered my qu

Re: [nodejs] Parse an SQL query into a JavaScript object

2014-07-15 Thread Matt
You'll need to write a parser. There are tools to help, e.g. http://pegjs.majda.cz/documentation On Tue, Jul 15, 2014 at 1:25 PM, João Rodrigues wrote: > I want to create a parser, possibly recursive to use in my GIS application > that work on top of OpenLayers 2. > > I have a query like this:

[nodejs] Parse an SQL query into a JavaScript object

2014-07-15 Thread João Rodrigues
I want to create a parser, possibly recursive to use in my GIS application that work on top of OpenLayers 2. I have a query like this: name = 1 OR name = 2 OR name in(3,4) The query is written in SQL style. I want an output like this (as an array of expressions and operators): var rules = [