Re: Error reporting issue in SimpleParameterList

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Error reporting issue in SimpleParameterList
Дата
Msg-id Pine.BSO.4.64.0706130324400.18039@leary.csoft.net
обсуждение исходный текст
Ответ на Error reporting issue in SimpleParameterList  (<Nathan.Keynes@csiro.au>)
Список pgsql-jdbc

On Wed, 13 Jun 2007, Nathan.Keynes@csiro.au wrote:

> In org.postgresql.core.v3.SimpleParameterList there is the following
> code:
>
>    void setResolvedType(int index, int oid) {
>        // only allow overwriting an unknown value
>        if (paramTypes[index-1] == Oid.UNSPECIFIED) {
>            paramTypes[index-1] = oid;
>        } else if (paramTypes[index-1] != oid) {
>            throw new IllegalArgumentException("Can't change resolved
> type for param: " + index + " from " + paramTypes[index] + " to " +
> oid);
>        }
>    }
>
> In the throw statement, paramTypes[index] should be paramTypes[index-1].
> (This was a little confusing until we spotted it).

Fix applied to CVS for 8.0, 8.1, 8.2, and 8.3dev.

> It's possible the message could be more explanatory as well, would
> something like "Param " + index + " type mismatch - expected " +
> getNameForOid(oid) + " but was bound to " +
> getNameForOid(paramTypes[index-1])  make sense?
>

Getting the names for the oids is tough from this part of the code so I
don't think we can do that.  Also I think this is supposed to be a "can't
happen" error that's more of an assert than a message for an end user.
Do you have an example of how to trigger this condition?

Kris Jurka

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

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Re: Using INET types in prepared statements in Java?
Следующее
От: Thomas Burdairon
Дата:
Сообщение: Re: Using INET types in prepared statements in Java?