Parser?

Sam Hough
2010-04-09
2012-09-29
  • Sam Hough
    Sam Hough
    2010-04-09

    Is there a parser that can reconstruct the object graph from a SQL statement?

    I'm thinking about using SqlBuilder as the object model for an ad hoc query
    builder but then want to store the query as plain old SQL...

    Code looks really nice but I suspect I can't do round trip like this.

    Cheers

    Sam

     
  • James Ahlborn
    James Ahlborn
    2010-04-19

    I don't currently know of any code for turning a SQL query into a SqlBuilder
    object graph, sorry. Someone else had previously suggested making the
    SqlBuilder objects Serializable (although they never pursued the idea). this
    might be a reasonable way of persisting the generated graph, however, you
    could end up with references to all kinds of crazy objects in a SqlBuilder
    object graph (e.g. dbspec.Table implementation instances) so that would only
    really work in very tightly constrained situations. it's possible that you
    could use some sort of xml persistence library to automagically serialize the
    object graph (just throwing out ideas).

     
  • Sam Hough
    Sam Hough
    2010-04-19

    Thanks,

    I've started looking at h2's parser... The parser seems simple to play with
    although, obviously, their object model is heavily about how to execute the
    SQL...