Extract field expressions from select

19 views
Skip to first unread message

Eduardo Ramos Ibáñez

unread,
Jul 1, 2015, 2:24:53 PM7/1/15
to jooq...@googlegroups.com
Hi,

I was wondering wether it's possible to extract fields from a select, but without being limited to their alias?
If I use select.fields() I get the alias of the fields, but I cannot access the underlying expression of each one.

This would be useful for extracting selected expressions from an unknown select and adding filters based on them (without doing a subselect, for which alias fields are fine).

As a workaround, I guess I can always keep a separate collection of fields and provide it with the select, but I would like to avoid doing that if possible.

Thank you

Lukas Eder

unread,
Jul 13, 2015, 1:28:39 PM7/13/15
to jooq...@googlegroups.com
Your use-case sounds perfect for jOOQ's VisitListeners:

I've just recently written a blog post about how to implement row-level security with jOOQ:

And Aakash, a jOOQ user has just recently written his own blog post about a similar use-case:

Let me know if this is helpful for now. If you want to go down that path, I'll be very happy to provide assistance with any concrete questions that you may have.

Cheers
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eduardo Ramos Ibáñez

unread,
Jul 15, 2015, 8:24:12 AM7/15/15
to jooq...@googlegroups.com
Hi Lukas,
Thanks, I will take a look at that and see if it can help us better than keeping track of the expressions.

Though I think some methods to extract information from the Select API would be a really useful addition.

Thank you,
Eduardo

Lukas Eder

unread,
Jul 15, 2015, 8:31:04 AM7/15/15
to jooq...@googlegroups.com
Yes, it would be very useful, indeed, and much simpler than transforming the AST via the VisitListener SPI.

We're looking into reworking the "model API" in jOOQ 4.0:

The current design won't let us expose all AST elements cleanly to clients, I'm afraid.

Cheers,
Lukas
Reply all
Reply to author
Forward
0 new messages