issue using '' in inline

8 views
Skip to first unread message

Denis Miorandi

unread,
Nov 22, 2016, 7:31:13 AM11/22/16
to jOOQ User Group
Hi Lukas,

I'm building a field to use in my select, but 

Field<String> padded=inline("SUBSTRING("+AGENCIES.ID.getName()+", PATINDEX('%[^0]%', "+AGENCIES.ID.getName()+"+'.'), LEN("+AGENCIES.ID.getName()+"))");

but the following has duplicated quote '' instead of '

'SUBSTRING(ID, PATINDEX(''%[^0]%'', ID+''.''), LEN(ID))'

any ideas how to achieve this?

Lukas Eder

unread,
Nov 22, 2016, 8:20:41 AM11/22/16
to jooq...@googlegroups.com
Hi Denis,

Whew, I'm glad this still works. This means that the SQL injection protection is still functional :)

DSL.inline() is for creating "inlined variables" (or constants), like DSL.val(), which creates "ordinary bind variables". See:

What you're looking for is DSL.field(), which gives you access to the plain SQL API at your own SQL injection risk. See:

Hope this helps,
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis Miorandi

unread,
Nov 22, 2016, 2:08:49 PM11/22/16
to jooq...@googlegroups.com

Got it. It works tks 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/YxK63hfFbFw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages