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

From Oliver Jowett
Subject Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT
Date
Msg-id 43A7ACCC.3020601@opencloud.com
Whole thread Raw
In response to Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly  ("j.random.programmer" <javadesigner@yahoo.com>)
Responses Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly  ("j.random.programmer" <javadesigner@yahoo.com>)
List 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

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
Next
From: Oliver Jowett
Date:
Subject: Re: 8.2dev-500.jdbc3 driver: PreparedStatement.toString()