Hi Ariel, Thanks for reporting this. This is indeed a bug because the getSQL() and getBindValues() methods should work together for use-cases where jOOQ is used to generate but not to execute SQL. I have registered #3131 for this: https://github.com/jOOQ/jOOQ/issues/3131
As this will incompatibly change behaviour, I think it will be better not to merge this fix to 3.2 and 3.3 minor releases. In the mean time, as a workaround, you could implement a VisitListener or a BindContext to extract bind values from your queries. Note that the BindContext SPI is an internal SPI, so workarounds built upon this SPI might break in future releases. Let me know if you have any questions regarding the above SPIs. Another, perhaps a bit simpler workaround is to use Query.getParams() http://www.jooq.org/javadoc/latest/org/jooq/Query.html#getParams() ... and then retain only those Params that have the inline flag set to false: http://www.jooq.org/javadoc/latest/org/jooq/Param.html#isInline() Cheers Lukas 2014-03-14 19:55 GMT+01:00 Ariel Tal <[email protected]>: > Hi, > Not sure if this is a bug or I'm missing some other way to achieve what > I'm trying to do. > > I realize this slightly goes around the 'fetch' capabilities of JOOQ but > this is my use-case: > > 1. Use JOOQ as an SQL builder by constructing queries and using > getSQL() to get a prepared statement template. > 2. Create a prepared statement on using the template and bind the > values as passed by the Select<?> object, by calling getBindValues and > iterating over the results. > > *The problem*: inlined parameters replace the '?' sign, but are included > in the BindValues list. > > Tried using 'val' but that produces another '?' which is not necessary if > this value doesn't change. > Is this a bug? Is there a different way to get the bind values? > > Thanks in advance, > Ariel > > -- > 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]. For more options, visit https://groups.google.com/d/optout.
