Обсуждение: 9.3 and extended constraint error information

Поиск
Список
Период
Сортировка

9.3 and extended constraint error information

От
Thomas Kellerer
Дата:
Hello,

I was wondering if the new extended constraint error information[1] will be exposed through JDBC in the next version of
thedriver? 

Regards
Thomas

[1] http://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD

Re: 9.3 and extended constraint error information

От
Kris Jurka
Дата:

On Wed, 11 Sep 2013, Thomas Kellerer wrote:

> I was wondering if the new extended constraint error information[1] will be
> exposed through JDBC in the next version of the driver?
>

Yes,

https://github.com/pgjdbc/pgjdbc/commit/e9ac5f8d964202ab5d43e401d74dcd76cefd112e

It's a little messy to get access to these fields with something like:

} catch (SQLException sqle) {
  if (sqle instanceof PSQLException) {
    PSQLException psqle = (PSQLException)sqle;
    ServerErrorMessage s = psqle.getServerErrorMessage();
    // Not all PSQLExceptions come from the server...
    if (s != null) {
      System.err.println(s.getColumn());
    }
  }
}

Kris Jurka


Re: 9.3 and extended constraint error information

От
Thomas Kellerer
Дата:
Kris Jurka, 11.09.2013 00:40:
>
>
> On Wed, 11 Sep 2013, Thomas Kellerer wrote:
>
>> I was wondering if the new extended constraint error information[1] will be
>> exposed through JDBC in the next version of the driver?
>>
>
> Yes,
>
> https://github.com/pgjdbc/pgjdbc/commit/e9ac5f8d964202ab5d43e401d74dcd76cefd112e
>
> It's a little messy to get access to these fields with something like:
>
> } catch (SQLException sqle) {
>   if (sqle instanceof PSQLException) {
>     PSQLException psqle = (PSQLException)sqle;
>     ServerErrorMessage s = psqle.getServerErrorMessage();
>     // Not all PSQLExceptions come from the server...
>     if (s != null) {
>       System.err.println(s.getColumn());
>     }
>   }
> }

Ah, great. That's good enough for me.

Thanks for the feedback
Thomas