Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT
Date: 2005-12-20 07:03:40
Message-ID: 43A7ACCC.3020601@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

j.random.programmer wrote:

> Anywho, in the JDBC driver, why not convert
> java booleans as follows:
>
> true -> '1'
> false -> '0'
>
> and store that in the BIT column ?

That wouldn't help you as the parameter is typed as boolean at the
protocol level, as is reflected in your error message -- it is a type
issue, not a representation issue.

If you really want to do a conversion, make it explicit in your query.

> 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...)

We do that already.

> b) If there are any 1's present, return true
> is retrieving it as boolean, false if all 0's.

That seems very error-prone.

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-12-20 07:05:28 Re: 8.2dev-500.jdbc3 driver: PreparedStatement.toString()
Previous Message Dave Cramer 2005-12-20 00:14:16 Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly