From: Dave Cramer <pg@fastcrypt.com>
To: j.random.programmer <javadesigner@yahoo.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
Date: Mon, 19 Dec 2005 19:14:16 -0500
Message-ID: <84E313E6-33AC-411E-BB79-7973BA500BBD@fastcrypt.com> (raw)
In-Reply-To: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com>
References: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com>
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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, javadesigner@yahoo.com
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
In-Reply-To: <84E313E6-33AC-411E-BB79-7973BA500BBD@fastcrypt.com>
References: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com> <84E313E6-33AC-411E-BB79-7973BA500BBD@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox