Hi robjs,

I am using SLQServer2012 dialect.

On Wednesday, February 24, 2021 at 9:36:36 AM UTC+7 [email protected] 
wrote:

> Which sql dialect has a “contains” function?
>
> On Feb 23, 2021, at 7:02 PM, Tuan Quoc <[email protected]> wrote:
>
> When I run this code: 
> DSLContext.selectFrom(tableName).where(DSL.field("fieldName").contains("value"))
>  
> -> the query is generated like this:
>
>
> (1)  Select * from tableName where fieldName like ('%' + 
> replace(replace('"value*"'), '!', '!!'), '%', '!%'), '_', '!_' + '%') 
> escape '!'
>
> But the desired query is like this:
> (2) Select * from tableName where Contains(fieldName, '"value*"')
>
> The result of runnning query (1) is different from running query (2)
>
> How do I use JOOQ to generate the query that looks like (2). Do you have 
> any solutions for this?
> On Wednesday, February 24, 2021 at 2:55:40 AM UTC+7 [email protected] 
> wrote:
>
>> Hi Tuan,
>>
>> I'm sorry, I'm not sure I understand what you mean. Can you show a more 
>> specific example with some example data?
>>
>>
>> On Tue, Feb 23, 2021 at 4:47 PM Tuan Quoc <[email protected]> wrote:
>>
>>> Hi Lukas,
>>>
>>> I am trying to implement Contains(field, value) by using 
>>> DSL.field("fieldName").contains("value") and it will be generated like 
>>> this: 
>>> fieldName like ('%' + replace(replace('"value*"'), '!', '!!'), '%', 
>>> '!%'), '_', '!_' + '%') escape '!'
>>>
>>> When I run the query with Contains(fieldName, value), there are multiple 
>>> rows affected but when I tried running the generated query above, there is 
>>> no rows affected.
>>>
>>> Do you have any solutions for this? 
>>>
>>> Thanks a lot in advance.
>>>
>>> Thanks
>>> Tuan
>>>
>>> -- 
>>> 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/839db656-4869-4df0-aa92-5e39a6d7cc1fn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jooq-user/839db656-4869-4df0-aa92-5e39a6d7cc1fn%40googlegroups.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/923bd718-fcd1-444a-ab7b-92ac5b844e16n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jooq-user/923bd718-fcd1-444a-ab7b-92ac5b844e16n%40googlegroups.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/8e310ae1-85af-4aed-90c3-683fd660068bn%40googlegroups.com.

Reply via email to