Re: ResultSet with more than 5 rows causes error

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: ResultSet with more than 5 rows causes error
Дата
Msg-id Pine.BSO.4.64.0710010309130.30230@leary.csoft.net
обсуждение исходный текст
Ответ на Re: ResultSet with more than 5 rows causes error  ("Ludovico Bianchini" <metlud@yahoo.it>)
Ответы Re: ResultSet with more than 5 rows causes error  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc

On Thu, 27 Sep 2007, Ludovico Bianchini wrote:

> Sorry, the error does not seem to be in the ResultSet but instead in the
> Callable Statement, method execute().
>
> java.lang.NullPointerException
>        at
> org.postgresql.core.v3.SimpleParameterList.getV3Length(SimpleParameterList.java:228)
>        at
> org.postgresql.core.v3.QueryExecutorImpl.sendBind(QueryExecutorImpl.java:807)
>        at

I've managed to reproduce this problem with the attached test case.
At fault are the ill conceived side effects in
org.postgresql.core.v3.SimpleParameterList#getTypeOID.  An accessor
like getTypeOID shouldn't be responsible for setting a value for the
out parameter.  getTypeOID is called from QueryExecutorImpl's
sendParse method, which obviously isn't called when we reuse a server
side prepared statement and don't need to reparse.  This leaves an
uninitialized value in the paramValues array which we die on later.

How can overriding things in getTypeOID be wise without doing the
same overriding in getTypeOIDs?  In any case that all seems like the
wrong approach.  It would be ideal to be able to handle all of this in
registerOutParameter, but that is tricky for INOUT parameters which
can come from two places in either order.  What about putting all the
oid/value hacking into checkAllParametersSet which we can be sure will
be called?

It won't get called for describe only executions, which doing a
little testing doesn't seem to work for CallableStatements in the
first place.  Maybe for clarity a separate method should be added to
SimpleParameterList to do the OUT parameter mashing.

Dave, your thoughts?

Kris Jurka

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Prepared Statements vs. pgbouncer
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: rs.getBigDecimal returning Null on field that is not null