Thanks for your rapid response!  Here’s some clarifications:

> On Jun 22, 2020, at 9:54 AM, Lukas Eder <[email protected]> wrote:
> 
> 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] 
> <mailto:[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

Here I’m asking for these to be made present in the SQL that is printed, so 
that a query that JOOQ parses as “1” = 1 it would print as cast “1” as integer 
= 1.  

>  
>  - "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().

I’d like for JOOQ to parse “Insert Into Employees Select * >From Employees” and 
have JOOQ print “Insert Into Employees Select e.name as name, e.id 
<http://e.id/> as id from Employees as E"

>  
>  - “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

I’d like for JOOQ to parse

>From Employee, Department
Where Employee.id <http://employee.id/> = Department.name

And have it print:

>From Employee as E, Department as d
Where e.id <http://e.id/> = d.name

i.e. have JOOQ insert as many temporary table names as it can.

>  
>  - “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?

I’m trying to use JOOQ as a “universal parser” for a very simple 
select/from/where fragment of SQL with a simple abstract syntax, but across a 
bunch of vendors at once.  But perhaps this is the same problem as the problem 
above - how to insert new variables in from clauses.  

>  
>  - “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/
>  
> <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 
> <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!

Will do!

-Ryan 


> 
> Lukas
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "jOOQ User Group" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/jooq-user/VKee0sUdG-w/unsubscribe 
> <https://groups.google.com/d/topic/jooq-user/VKee0sUdG-w/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jooq-user/CAB4ELO6Gzmb2zdxY%2BWn3-9LrBMPNBDqO1c5zxqi3zPUD1QdFAw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/jooq-user/CAB4ELO6Gzmb2zdxY%2BWn3-9LrBMPNBDqO1c5zxqi3zPUD1QdFAw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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/19A0A8D7-D7D6-4230-ACB1-B5A6091524FA%40conexus.com.

Reply via email to