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 20051219220938.81809.qmail@web32001.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
Dave:

> The problem is that we don't know in advance if the
> underlying column
> is a bit, or a boolean. Postgresql supports
> both, the jdbc API   doesn't appear to.

You can get from the database the actual
type defined in the database for that column
right ? (so if it's BIT your driver can tell it's
BIT in the database, I presume).

So then, as per the JDBC spec
1) while retrieving:
convert that BIT (however long it may be) into a
boolean [true, say, it it's all 1's else false].
2) while saving:
convert java true to a '1' and save that as a BIT
(convert java false to '0').

That's what the spec suggests from what I can
tell. Of course, you could also convert the
BIT into a string if the user wants it as a string).

Best regards,
--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: 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()