Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 561CB633146 for ; Tue, 12 May 2009 05:07:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 60465-05 for ; Tue, 12 May 2009 05:07:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mk-filter-1-a-1.mail.uk.tiscali.com (mk-filter-1-a-1.mail.uk.tiscali.com [212.74.100.52]) by mail.postgresql.org (Postfix) with ESMTP id 7DB4B632309 for ; Tue, 12 May 2009 05:04:02 -0300 (ADT) X-Trace: 197590522/mk-filter-1.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/80.225.59.140/None/john.lister@kickstone.com X-SBRS: None X-RemoteIP: 80.225.59.140 X-IP-MAIL-FROM: john.lister@kickstone.com X-SMTP-AUTH: X-MUA: Thunderbird 2.0.0.21 (Windows/20090302) X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsgBAJvJCEpQ4TuM/2dsb2JhbAAIzACEAgU X-IronPort-AV: E=Sophos;i="4.41,181,1241391600"; d="scan'208";a="197590522" Received: from 80-225-59-140.dynamic.dial.as9105.com (HELO [192.168.6.11]) ([80.225.59.140]) by smtp.tiscali.co.uk with ESMTP; 12 May 2009 09:04:00 +0100 Message-ID: <4A092D2E.3070905@kickstone.com> Date: Tue, 12 May 2009 09:02:54 +0100 From: John Lister User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Luca Ferrari CC: pgsql-jdbc@postgresql.org Subject: Re: ResultSet internal data type handling References: <200905120939.07478.fluca1978@infinito.it> In-Reply-To: <200905120939.07478.fluca1978@infinito.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/55 X-Sequence-Number: 19605 Luca Ferrari wrote: > Having a look at jdbc2.AsbtractJDBC2ResultSet (the parent of all ResultSets) I > discovered that all data received from the server is handled internally as a > string (right?) and is converted from the getXXX methods into the appropriate > type. This means that you can actually write a getString on a date field > obtaining a valida date (and if you are lucky you can do something the > opposite). I'm curious to know if this is an implementation choice or a jdbc > specification and why the objects are not checked against the table metadata > (as the getInternalObject method does). > I believe the original wire protocol only supported text values hence the driver converts all data into a string before sending it to the server... Because of this the server will generally convert any value into the appropriate type (if this conversion is possible) which saves the driver from doing so. This simplifies the driver at the expense of extra network traffic and errors thrown by the server as opposed to the driver. The original authors can probably expand on this Thanks JOHN