[Pljava-dev] Java 6: Copy code from the JDBC driver?

Lists: pljava-dev
From: johann at myrkraverk(dot)com (Johann 'Myrkraverk' Oskarsson)
To:
Subject: [Pljava-dev] Java 6: Copy code from the JDBC driver?
Date: 2010-10-06 23:33:07
Message-ID: AANLkTinBPuSS7e93UWC4HzkoGbhQ_-X11YQSDwjLaRJx@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pljava-dev

Hi pljava,

Glossary

JDBC Driver: The driver for Java client applications.
SPI Driver: The PL/Java internal JDBC driver.

The Java 6 JDBC API defines several new virtual methods. One of which
is Connection.createStruct(). The JDBC Driver throws in a roundabout
way an equivalent to

throw new SQLException( "Method SPIConnect.createStruct(String,
Object[]) is not yet implemented.", "0A000");

Using a utility class PSQLException and the constant "0A000" comes
from the static PSQLState object NOT_IMPLEMENTED.

Is it worthwhile to copy this code as-is from the JDBC driver or
should we implement our own "not implemented" exception code path,
such as using SQLFeatureNotSupportedException?

I'm inclined to the latter.

Johann


From: johann at myrkraverk(dot)com (Johann 'Myrkraverk' Oskarsson)
To:
Subject: [Pljava-dev] Java 6: Copy code from the JDBC driver?
Date: 2010-10-07 11:22:33
Message-ID: AANLkTinuVNxvSGjBJZZnXt9=G1R=oD0=ZNA-w3-PhYqB@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pljava-dev

Hi Thomas,

On Thu, Oct 7, 2010 at 5:14 AM, Thomas Hallgren <thomas at tada.se> wrote:
> On 10/07/2010 01:33 AM, Johann 'Myrkraverk' Oskarsson wrote:

>> The Java 6 JDBC API defines several new virtual methods. ?One of which
>> is Connection.createStruct(). ?The JDBC Driver throws in a roundabout
>> way an equivalent to
....
>> Using a utility class PSQLException and the constant "0A000" comes
>> from the static PSQLState object NOT_IMPLEMENTED.
>>
>> Is it worthwhile to copy this code as-is from the JDBC driver or
>> should we implement our own "not implemented" exception code path,
>> such as using SQLFeatureNotSupportedException?
>>
>> I'm inclined to the latter.

> So am I. It's much easier to trap exceptions when using inheritance. The
> important thing is that we propagate correct error codes on uncaught
> exceptions.

The PSQLException does inherit SQLException. I'll start throwing
SQLFeatureNotSupportedExceptions. Stay tuned for CVS updates.

Johann