JOOQ PlainText SQL Param binding (by name) Firebird

99 views
Skip to first unread message

Buddhika Ekanayake

unread,
Jun 5, 2022, 1:40:06 AM6/5/22
to jOOQ User Group
Hi All, 

For a specific case, I want to use jooq as a sql executor to fetch plain text queries(selectable). Lukas has explained a workaround in this stackoverflow but I'm not sure it's actually binding the param by name (AS IS) rather than placing param values according to the binding order @index. (changing the param name wont effect, query works).

See below sample query. 

Select *
From mySP(:Val:Name, 0, 9999) d 
Left Join Samples s on (s.id_sample = d.id_sample)
Where s.ref=:Extref and s.val = :Val
      
Assume the user has requested above selectable sql and send the parameter values separately. So I need to execute this via jooq with binding each params by its name at the prepare. These are the steps. 
  1. assign the query to jooq. 
  2. prepare it. get/fetch the params list. (in this case :Val, :Name, :ExtRef)
  3. bind each param by name (note :Val is used in 2 places, so single binding by name should be enough). 
Could anybody kindly show me how to achieve this with JOOQ. 
(Java Spring SOAP API, JOOQ: 3.11.0 on Firebird 3) 

Thank You. 

Regards, 
Buddhika E.

Lukas Eder

unread,
Jun 13, 2022, 10:17:09 AM6/13/22
to jOOQ User Group
Hi Buddhika,

Thanks for your message. I'm not sure what your exact question is, here. You haven't shared any jOOQ code of what you've tried, or what you're attempting to do with jOOQ specifically. So, I'm assuming, you're just looking for this documentation page?

There are Query.bind(String, Object) and similar methods that you could use if you must absolutely avoid binding the value twice, but do note that this doesn't optimise anything as JDBC doesn't support named bind values
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/d98a4a42-8379-45e6-9ddf-5f51e9a8a821n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages