2015-09-03 3:53 GMT+02:00 <[email protected]>:

> O.K. So I'm having a couple of issues trying to flesh these suggestions
> out.
>
> Two main things:
>
> (1) I couldn't find DSL.list(QueryPart). There is DSL.listAgg, but that
> doesn't seem like the right thing.
>

It's here:
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#list-org.jooq.QueryPart...-

It was added in jOOQ 3.6:
https://github.com/jOOQ/jOOQ/issues/4085


> My other attempt at using the templating as per your suggestion ended up
> quoting the entire contents of the ct() function call as one string. So, I
> kind of gave up. Ff there's an obvious mistake I'm making, please let me
> know.
>

I'd have to see your attempts...
But it's also OK to just concatenate the relevant strings, if that feels
easier. Just be sure to sanitize your inputs and avoid SQL injection
vulnerabilities.


> (2) The other thing I'd like to do is grab the resultQuery, and rather
> than just fetch from it, I'd like to join against it making new query. Is
> that even possible? What I think I need to do is somehow make a TableLike
> out of the resultQuery value, but I can't find a way forward there.
>

DSL.table(String) and other methods allow you to create a Table<Record>
from any SQL string:
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#table-java.lang.String-org.jooq.QueryPart...-


> I have workarounds to both of these (the workaround for (1) is just to
> leave things as they are, and the workaround for (2) is to make very
> complicated raw and crosstabValues queries, which only works sometimes).
>

Workaround #3: Create a table-valued function (a function returning TABLE
or SETOF types) and use that.

Any insight would be appreciated, but I don't want to take up too much of
> your time.
>

No worries! This could be useful to many other users, I'd like to know more
about this. Perhaps, we'll even be able to emulate Table.pivot() via
crosstab for PostgreSQL

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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to