Re: setObject on PGInterval throws "Unknown Type null"

From: "Jean-Pierre Pelletier" <pelletier_32(at)sympatico(dot)ca>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "Kris Jurka" <books(at)ejurka(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: setObject on PGInterval throws "Unknown Type null"
Date: 2005-01-26 21:03:08
Message-ID: BAYC1-PASMTP034FB41F0D2750919A332895870@cez.ice
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

new method names such as setInterval would be fine with me,
as I don't mind changing my code.

It doesn't fix the general case, but at least if fixes PGInterval which is
an improvement.

The advantage of overloaded versions of setObject over new method names was
to
provide backward compatibility for setObject(i,x)
i.e. no need to recode setObject(i,x) to setObject(i,x,Types.someType)
because setObject(i,x) is now broken with null objects.

I don't know how important is backward compatibility, that's your call.

Jean-Pierre Pelletier

----- Original Message -----
From: "Oliver Jowett" <oliver(at)opencloud(dot)com>
To: "Jean-Pierre Pelletier" <pelletier_32(at)sympatico(dot)ca>
Cc: "Kris Jurka" <books(at)ejurka(dot)com>; <pgsql-jdbc(at)postgresql(dot)org>
Sent: Wednesday, January 26, 2005 2:47 PM
Subject: Re: [JDBC] setObject on PGInterval throws "Unknown Type null"

> Jean-Pierre Pelletier wrote:
>
>> public void setObject(int parameterIndex, PGInterval x)
>> throws SQLException
>
> Overloading setObject() sounds very risky. How about this instead:
>
> public void setInterval(int parameterIndex, PGInterval x)
> throws SQLException
>
> That said, this doesn't help the general case as we can't know the set of
> extension types ahead of time.
>
>> public void setObject(int parameterIndex, Integer x)
>> throws SQLException
>
>> public void setObject(int parameterIndex, String x)
>> throws SQLException
>
> I don't see the benefit of these methods; they're just a nonstandard way
> of doing things that standard JDBC already lets you do (the second one
> especially -- it's identical to PreparedStatement.setString())
>
> -O
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-01-26 21:19:46 Re: setObject on PGInterval throws "Unknown Type null"
Previous Message Oliver Jowett 2005-01-26 19:47:28 Re: setObject on PGInterval throws "Unknown Type null"