Hi Ryan, Thanks for your message.
I'm assuming you're still using the parser and try to transform the generated SQL in jOOQ. You'll have to find a way to detect the cases that you've mentioned below, but once you do, I think all is possible: On Mon, Jun 22, 2020 at 6:31 PM Ryan Wisnesky <[email protected]> wrote: > Thanks again! I’m still making progress with my use case and had a few > more quick questions: when emitting SQL code, is there a way to force: > > - implicit type coercions to made explicit? i.e., “1” = 1 ~~~> cast “1” > as integer = 1 > Use Field.cast(DataType) or DSL.cast(Field, DataType), they're equivalent > - "select *" to emit as the named expressions? I.e., select * ~~~> > select x.y as z, p.q as r … > It depends on much you insist on precisely this transformation. The simplest transformation would be to just wrap the query in a derived table and work with Select.getSelect(). > - “from" to name every column? i.e., from A, B ~~~> from A as a, B.b as b > I'm not sure what this means > - “where” to qualify every field reference? i.e., where A = B ~~~> a.A = > b.B > The parser does this if you enable Settings.parseWithMetaLookups (you will have to provide jOOQ with some Meta data source via Configuration.set(MetaProvider)). But when the parser does this, it doesn't transform the SQL currently to produce qualified identifiers in the output. What's the use case of this transformation? > - “join" syntax into select/from/where syntax > You can do this via: https://www.jooq.org/doc/3.13/manual/sql-building/queryparts/sql-transformation/ansi-join-to-table-lists/ In the future, we'll implement quite a few such SQL transformations out of the box: https://github.com/jOOQ/jOOQ/issues/9767 I will create a few issues for the ones you've mentioned here, I think they could be quite useful for others. If you have more such use-cases, I'd love to hear about them! Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO6Gzmb2zdxY%2BWn3-9LrBMPNBDqO1c5zxqi3zPUD1QdFAw%40mail.gmail.com.
