X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 644393A5C51 for ; Wed, 26 Jan 2005 19:22:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48034-09 for ; Wed, 26 Jan 2005 19:22:50 +0000 (GMT) Received: from bayc1-pasmtp02.bayc1.hotmail.com (bayc1-pasmtp02.bayc1.hotmail.com [65.54.191.162]) by svr1.postgresql.org (Postfix) with ESMTP id 4807B3A5C24 for ; Wed, 26 Jan 2005 19:22:50 +0000 (GMT) Message-ID: X-Originating-IP: [67.71.80.34] X-Originating-Email: [pelletier_32@sympatico.ca] Received: from JP ([67.71.80.34]) by bayc1-pasmtp02.bayc1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 11:22:49 -0800 Message-ID: <003801c503dc$6fc07720$6400a8c0@JP> From: "Jean-Pierre Pelletier" To: "Oliver Jowett" , "Kris Jurka" Cc: References: <41F557C8.6030805@opencloud.com> <41F6B5CE.3040107@opencloud.com> <41F6D3EC.5000103@opencloud.com> <41F6D733.7010702@opencloud.com> Subject: Re: setObject on PGInterval throws "Unknown Type null" Date: Wed, 26 Jan 2005 14:22:53 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-OriginalArrivalTime: 26 Jan 2005 19:22:49.0518 (UTC) FILETIME=[6C55D4E0:01C503DC] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.564 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, MSGID_FROM_MTA_HEADER X-Spam-Level: X-Archive-Number: 200501/265 X-Sequence-Number: 12145 With JDBC Build 309, pstmt.setObject(i, x) has to be replaced by if (x == null) pstmt.setNull(i, Types.SomeType) else pstmt.setObject(i, x) which may be simplified as pstmt.setObject(i, x, Types.SomeType) That's what I was referring to when I said that setObject(i, x) has been rendered useless The type information could be provided regardless of null by a method specific to each class. It could use new method names or be overloaded versions of setObject for PGInterval, it could also hide SQL null => new PGInterval public void setObject(int parameterIndex, PGInterval x) throws SQLException { this.setObject(parameterIndex, x == null ? new PGInterval() : x); } These methods could also be available for jdbc buil-in types public void setObject(int parameterIndex, Integer x) throws SQLException { this.setObject(parameterIndex, x, Types.INTEGER); } public void setObject(int parameterIndex, String x) throws SQLException { this.setObject(parameterIndex, x, Types.VARCHAR); // could also be this.setString(parameterIndex, x); } I understand that this is not standard JDBC, but as you guys highlighted, there is no provision in the standard for supplying type with null values on extended types. Plus it would provide some form of backward compatibility for setObject(i,x) Jean-Pierre Pelletier ----- Original Message ----- From: "Oliver Jowett" To: "Kris Jurka" Cc: "Jean-Pierre Pelletier" ; Sent: Tuesday, January 25, 2005 6:33 PM Subject: Re: [JDBC] setObject on PGInterval throws "Unknown Type null" > Kris Jurka wrote: >> >> On Wed, 26 Jan 2005, Oliver Jowett wrote: >> >> >>>What about when we prepare a statement with a null parameter, then later >>>use it with a non-null parameter? There is some protocol code needed here >>>to get the inferred types back. >>> >>>We currently break in the case where parameter types change between >>>executions, but that's more easily fixable since we have all the >>>necessary information already available. >>> >> >> >> I'm not sure I'm willing to make that distinction, they seem like the >> same thing to me. If we fixed the second case and found the solution to >> the first intractable then you could make the case to require typed >> nulls, but since the second case is broken that argument doesn't carry a >> lot of weight with me. > > It's not unfixable, it just means there is more work required to fix the > existing brokenness. > > -O > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster