The workaround using getParams() works fine. Thanks for the quick response.

On Tuesday, April 8, 2014 2:09:57 AM UTC-7, Lukas Eder wrote:
>
> Hello,
>
> There's a known issue related to getBindValues() and inline parameters. 
> See also this recent discussion:
>
> - https://groups.google.com/d/msg/jooq-user/6nk8Fd6HiyM/5qll_hpNDVoJ
> - https://github.com/jOOQ/jOOQ/issues/3131
>
> Currently, you have two workarounds in your case:
>
> 1. Use a regular bind value for "SELECT 1", instead of an inlined one
> 2. Use the workaround discussed in the above thread:
>
> 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()
>
> I hope this helps,
> Lukas
>
>
> 2014-04-07 21:21 GMT+02:00 Vijay Ganesan <[email protected]<javascript:>
> >:
>
>>
>> Consider a query as follows:
>> select 1 from sometable where somecolumn = ?;
>> Calling getBindValues() on the org.jooq.Query object constructed for this 
>> query returns 2 values - the first one being 1 and the second one being the 
>> parameterized value for 'somecolumn' corresponding to the '?'. 
>> This causes a problem when iterating through the bind values and invoking 
>> the setObject(int parameterIndex, Object x) of java.sql.PreparedStatement - 
>> this will cause an exception such as:
>> org.postgresql.util.PSQLException: The column index is out of range: 2, 
>> number of columns: 1.
>>
>> Can someone suggest how to handle such a scenario? i.e. some way to 
>> ignore the constants which are not substitute-able indexed parameters.
>>
>> Thanks
>>   
>>
>> -- 
>> 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] <javascript:>.
>> 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.

Reply via email to