Alan. Instead of parsing the query yourself call the qlbridge rel.ParseSql. It should return a SqlCreate object that contains a SqlSelect.
The query rewriter is a start conceptually but 9 times out of 10 a view will contain a join of 2 or more tables. If you have the parsed SqlSelect object then you can iterate over the SqlSelect.From array and process all of the individual tables. The simple "parsing" logic inside the proxy is just used to dispatch to the sqldriver Query or Exec functions. A "Create view" statement would be processed as an "Exec". It's fine to parse and rewrite the query inside the proxy main loop if it makes sense or you can push this code inside qlbridge. I don't think this is complete enough to merge yet. Much more work to do.
Alan. Instead of parsing the query yourself call the qlbridge
rel.ParseSql
. It should return aSqlCreate
object that contains aSqlSelect
.The query rewriter is a start conceptually but 9 times out of 10 a view will contain a join of 2 or more tables. If you have the parsed
SqlSelect
object then you can iterate over theSqlSelect.From
array and process all of the individual tables. The simple "parsing" logic inside the proxy is just used to dispatch to the sqldriverQuery
orExec
functions. A "Create view" statement would be processed as an "Exec". It's fine to parse and rewrite the query inside the proxy main loop if it makes sense or you can push this code inside qlbridge. I don't think this is complete enough to merge yet. Much more work to do.