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

From j.random.programmer
Subject Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
Date
Msg-id 20051219234136.59714.qmail@web32012.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT
List pgsql-jdbc
> 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

pgsql-jdbc by date:

Previous
From: "j.random.programmer"
Date:
Subject: Re: 8.2dev-500.jdbc3 driver: PreparedStatement.toString() is buggy
Next
From: Dave Cramer
Date:
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly