0

I worked on a parser for arithmetic expressions. The key there was building a syntax tree, where leaves are variables and nodes are operators.

Not I'm thinking about parsing SQL queries. Parsing simple select won't be a problem, but I'm not pretty sure about the complex queries. Can you point me to a good reference about sql parsing. Thank you in advance!

Svetlozar Angelov
  • 21,214
  • 6
  • 62
  • 67

3 Answers3

4

Take a look at the SQL BNF grammars

nos
  • 223,662
  • 58
  • 417
  • 506
2

Some codesamples: Look at sourceforge Open SQL parser. There was a question for sql parser library before. Look there.

Community
  • 1
  • 1
Christian13467
  • 5,324
  • 31
  • 34
2

I'm not sure if you know C# or .NET, but LinqToSql basically does this by building expression trees that are then executed only when the query is 'called'.

Dan Diplo
  • 25,076
  • 4
  • 67
  • 89