Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 51859 invoked from network); 11 Jul 2006 01:05:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Jul 2006 01:05:01 -0000 Received: (qmail 33695 invoked by uid 500); 11 Jul 2006 01:05:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 33676 invoked by uid 500); 11 Jul 2006 01:05:00 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 33667 invoked by uid 99); 11 Jul 2006 01:05:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 18:05:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.43] (HELO brmea-mail-2.sun.com) (192.18.98.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 18:04:58 -0700 Received: from fe-amer-01.sun.com ([192.18.108.175]) by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6B14cUS012358 for ; Mon, 10 Jul 2006 19:04:38 -0600 (MDT) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0J2700401RAC4W00@mail-amer.sun.com> (original mail from Lance.Andersen@Sun.COM) for derby-dev@db.apache.org; Mon, 10 Jul 2006 19:04:38 -0600 (MDT) Received: from [129.150.64.84] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0J27000J1SBPVDS1@mail-amer.sun.com> for derby-dev@db.apache.org; Mon, 10 Jul 2006 19:04:38 -0600 (MDT) Date: Mon, 10 Jul 2006 21:04:40 -0400 From: "Lance J. Andersen" Subject: Re: behavior of Statement.getGeneratedKeys() In-reply-to: <44B2D393.8080703@apache.org> Sender: Lance.Andersen@Sun.COM To: derby-dev@db.apache.org Message-id: <44B2F928.7000007@sun.com> MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_ALqGsHSyN7gGbESUKcIAqQ)" References: <44B29397.4030608@sun.com> <44B2A411.3050000@sbcglobal.net> <44B2B783.1090102@sun.com> <44B2C2D6.8010700@sbcglobal.net> <44B2C4E2.3060200@sun.com> <44B2D393.8080703@apache.org> User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. --Boundary_(ID_ALqGsHSyN7gGbESUKcIAqQ) Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT Daniel John Debrunner wrote: > Lance J. Andersen wrote: > > >> Kathey Marsden wrote: >> >> >>> Rick Hillegas wrote: >>> > > >>> Certainly there are these changes for the ResultSet returned by >>> getGeneratedKeys(): >>> >>> o getMetaData() would correspond to the ResultSetMetadata of the >>> base table column and so will have different types, columnwidths etc, >>> so formatting and other decisions based on this information may be >>> affected. >>> >> Portable code would adjust accordingly to the correct width. This is >> what a tool would do. >> >> >>> o getObject() would return a different type and applications making >>> casts based on the assumption it is a BigDecimal may see cast >>> exceptions or other problematic behavior because of this assumption. >>> >> Or because you are returning a BigDecimal when someone is not expecting >> it, you also have problematic behavior. This fact is buried in the >> Derby docs currently. >> > > Well portable code would adjust accordingly to the type of the returned > object. :-) > Possibly, but if getColumns() tells me that the column is defined as an Integer in the table then and it is also reasonable to expect getGeneratedKeys() to return me an Integer. > Dan. > > > > --Boundary_(ID_ALqGsHSyN7gGbESUKcIAqQ) Content-type: text/html; charset=ISO-8859-1 Content-transfer-encoding: 7BIT

Daniel John Debrunner wrote:
Lance J. Andersen wrote:

  
Kathey Marsden wrote:

    
Rick Hillegas wrote:
      

  
Certainly there are these changes for the ResultSet returned by
getGeneratedKeys():

o  getMetaData()  would  correspond to the ResultSetMetadata of the
base table column and so will have different types, columnwidths etc,
so formatting and other decisions based on this information may be
affected.
      
Portable code would adjust accordingly to the correct width.  This is
what a tool would do.

    
o  getObject()  would  return a different type and applications making
casts based on the assumption it is a BigDecimal  may see cast
exceptions or other problematic behavior because of this assumption.
      
Or because you are returning a BigDecimal when someone is not expecting
it, you also have problematic behavior.  This fact is buried in the
Derby docs currently.
    

Well portable code would adjust accordingly to the type of the returned
object. :-)
  
Possibly,   but if getColumns() tells me that the column is  defined as an Integer in the table then and  it is also reasonable to expect getGeneratedKeys() to return me an Integer.
Dan.



  
--Boundary_(ID_ALqGsHSyN7gGbESUKcIAqQ)--