Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id EFAB06389AA for ; Tue, 20 Jul 2010 18:14:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 19217-03 for ; Tue, 20 Jul 2010 21:14:40 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [174.34.188.2]) by mail.postgresql.org (Postfix) with ESMTP id C9F756389A8 for ; Tue, 20 Jul 2010 18:14:41 -0300 (ADT) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:55001 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1ObK97-0004Hg-LB for pgsql-jdbc@postgresql.org; Tue, 20 Jul 2010 16:14:37 -0500 From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: Binary protocol support for JDBC Date: Tue, 20 Jul 2010 23:17:09 +0200 User-Agent: KMail/1.13.3 (Linux/2.6.33-gentoo-r2; KDE/4.4.4; x86_64; ; ) References: <201007202114.01608.rsmogura@softperience.eu> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201007202317.09772.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201007/71 X-Sequence-Number: 20736 > > This should be done without problem, because I added binary parameter to > > Connection and Datasources, so user can decide to use binary mode > > retrieve or current text mode (default). Currently I implemented > > retrieve of short, int, long, date and BigDecimal. Other simple and > > basic types, used in typically application I will implement shortly. > > One of the difficulties in the existing patch is knowing when to request > binary transfer and when to request text transfer because for the first > execution the datatypes are not known. How have you addressed > this problem? Hm... I've done only binary retrieve. I can think wrong, but I probably read and I didn't inspected this, but after you bind statement you can't change mode (binary / transfer) of parameters, so _probably_ in prepared statement will be inpossible to call setInt(1, val), and on 2nd call setString(1, stringVal) - not sure. About requesting binary transfer I assumed this 1) user sets binary for it's own responsibility (he must test application, and there is nothing special in this, because PG supporrts too many and special types, eg. inet address), so for example assuming that "scientific user" will be able to use it's own types may be wrong. 2) i request all result parameters to be in binary form, i decided to write parsers for all supported types :) with following code if (isBinary()) { pgStream.SendInteger2(1); pgStream.SendInteger2(1); }else{ pgStream.SendInteger2(0); } ///Orignal code from QueryExecutorImpl.sendBind pendingBindQueue.add(portal); if (bindException != null) { throw bindException; } so yours way is better. Regards, Radek