Re: SQLException and error code

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: SQLException and error code
Дата
Msg-id s2e8afd3.056@gwmta.wicourts.gov
обсуждение исходный текст
Ответ на SQLException and error code  (Peter.Zoche@materna.de)
Ответы Re: SQLException and error code  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
To better support existing applications which (for reasons I don't
really understand) rely on the vendor-specific errorCode instead of the
ANSI-standard sqlState, you could implement getErrorCode as:

    return Integer.parseInt(getSqlState(), 36);

-Kevin


>>> Oliver Jowett <oliver@opencloud.com> 07/26/05 6:33 PM >>>
Peter.Zoche@materna.de wrote:
> Because in the postgresql documentation you can find the following
page:
>
>
http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html#ERRCOD
> ES-TABLE
>
> There you can see all ERROR CODES!

Those codes are actually SQLSTATEs.

> So why is there a method getErrorCode(),

It's defined by the JDBC spec, we don't have any choice about whether it
is there or not.

> if the only thing it does
> is to return zero?

Back to my original question: what are you expecting it to return? It
can't return a SQLSTATE because it returns an int and SQLSTATE is
alphanumeric. We don't have any other useful error code. So we just
return 0 because we have to return *something*.

-O

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match


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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Proposed patch for showing originating query on error
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Proposed patch for showing originating query on error