Yes, that's what you will have to do. What I suggested here is a workaround... There aren't too many data types, so I guess the workaround is viable, no? What am I missing?
On Tue, Jul 16, 2019 at 3:54 PM <[email protected]> wrote: > Yes, I'm able to retrieve the DataType thanks to the Field.getDataType(). > But when I get the DataType, did you have an easy way in mind to generate > the 'dummy' value? > Currently, I have to hard code a list of dummy values per type, e.g. a > dummy String will be "aaa", a dummy Integer will be 0... > Is there a way to generate this dummy value easily from the DataType? > > On Tuesday, July 16, 2019 at 3:49:51 PM UTC+2, Lukas Eder wrote: >> >> Thanks for your message, Nelson. >> >> The DataType can be obtained from any Field using Field.getDataType(). >> >> I hope this helps, >> Lukas >> >> On Tue, Jul 16, 2019 at 3:47 PM <[email protected]> wrote: >> >>> Thanks for the SQL query example, I'm facing the same issue and tries to >>> solve it on my hand, by generating with jOOQ the kind of SQL query you >>> posted. >>> >>> You mentioned: >>> >>>> Since jOOQ knows the data type of account.name, we can generate a >>>> non-null dummy value. >>> >>> >>> Did you have an idea on how to generate this value from jOOQ? I looked >>> at the DataType class, but did not find a way to do this. Any pointer would >>> help! >>> >>> Thanks! >>> >>> >>> On Thursday, May 2, 2019 at 4:53:38 PM UTC+2, Lukas Eder wrote: >>>> >>>> Well, the generated predicates would have to handle nulls first / nulls >>>> last, just like if those clauses aren't supported by a given RDBMS, e.g. >>>> when writing: >>>> >>>> ctx.selectFrom(account) >>>> .orderBy(account.name.nullsLast(), account.id) >>>> .seekAfter(nameValue, idValue) >>>> .fetch(); >>>> >>>> >>>> The generated SQL would have to be: >>>> >>>> SELECT * >>>> FROM account >>>> WHERE >>>> (CASE WHEN account.name IS NULL THEN 1 ELSE 0 END, COALESCE ( >>>> account.name, 'dummy'), account.id) >>>> >>>> > (CASE WHEN :nameValue IS NULL THEN 1 ELSE 0 END, COALESCE >>>> (:nameValue, 'dummy'), account.id) >>>> >>>> ORDER BY account.name NULLS LAST, account.id >>>> >>>> >>>> Since jOOQ knows the data type of account.name, we can generate a >>>> non-null dummy value. >>>> >>>> Good luck to your performance on that one :-) >>>> >>>> On Thu, May 2, 2019 at 4:43 PM <[email protected]> wrote: >>>> >>>>> Hi Lukas, >>>>> >>>>> Yeah, it's a little bit messy to deal with, especially when trying to >>>>> generalize the coalesce statement to fields of other datatypes, but it >>>>> appears to be the only workaround for the moment. Not sure what can be >>>>> done >>>>> for #2786, but looking forward to it! >>>>> >>>>> Thanks again for your help! >>>>> >>>>> Mani >>>>> >>>>> This e-mail message is intended for the named recipient(s) above, and >>>>> may contain information that is privileged, confidential and/or exempt >>>>> from >>>>> disclosure under applicable law. If you have received this message in >>>>> error, or are not the named recipient(s), please do not read the content. >>>>> Instead, immediately notify the sender and delete this e-mail message. Any >>>>> unauthorized use, disclosure or distribution is strictly prohibited. >>>>> Quantify Labs Inc and the sender assume no responsibility for any errors, >>>>> omissions, or readers' misinterpretations and/ or understanding of the >>>>> content or transmission of this email. >>>>> >>>>> -- >>>>> 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. >>>>> >>>> -- >>> 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/ee24b65b-e91b-441e-827f-2253bcb48217%40googlegroups.com >>> <https://groups.google.com/d/msgid/jooq-user/ee24b65b-e91b-441e-827f-2253bcb48217%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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/36b3e06c-8efb-44d6-8724-ba4e27201ef5%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/36b3e06c-8efb-44d6-8724-ba4e27201ef5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAB4ELO5bbyWJrvBw-hr0DfMEsfsxpgMgzgR2yUmK1Jzzt8R64w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
