X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B32A79DC9F5 for ; Mon, 19 Dec 2005 20:14:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37779-02 for ; Mon, 19 Dec 2005 20:14:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 1F01E9DC9E9 for ; Mon, 19 Dec 2005 20:14:13 -0400 (AST) Received: (qmail 20443 invoked from network); 20 Dec 2005 00:14:17 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Dec 2005 00:14:17 -0000 In-Reply-To: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com> References: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <84E313E6-33AC-411E-BB79-7973BA500BBD@fastcrypt.com> Cc: List Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly Date: Mon, 19 Dec 2005 19:14:16 -0500 To: j.random.programmer X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.134 required=5 tests=[AWL=0.134] X-Spam-Score: 0.134 X-Spam-Level: X-Archive-Number: 200512/89 X-Sequence-Number: 14420 This isn't the problem. The problem is that was bind the parameter to the type. So setBoolean binds the parameter to a boolean type. putting ' quotes around it will not help matters. Dave On 19-Dec-05, at 6:41 PM, j.random.programmer wrote: >> JDBC's "BIT" is actually a boolean type. In >> JDBC3, BIT and BOOLEAN are effectively >> equivalent. > > Hmm. > >> The backend's "bit" type is actually a bitstring >> that does not have a >> direct equivalent in JDBC. > > Aha ! > > So postgres really has a BITSTRING which is > conceptually different from a BIT type ? (since > BIT is also used instead of BITSTRING, you > can see why there is bound to be confusion). > > Anywho, in the JDBC driver, why not convert > java booleans as follows: > > true -> '1' > false -> '0' > > and store that in the BIT column ? > > While retrieving, do the reverse conversion. > > Of course, if someone has the following > in the BIT column > > '1001010' > > then: > a) allow the entire value to be retrieved as a String > (getString...) > b) If there are any 1's present, return true > is retrieving it as boolean, false if all 0's. > > Best, > -j > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster >