Skip site navigation (1) Skip section navigation (2)

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

From: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly
Date: 2005-12-19 22:09:37
Message-ID: 20051219220938.81809.qmail@web32001.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: 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 

In response to

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-12-19 23:28:48
Subject: Re: 8.2dev-500.jdbc3 driver: PreparedStatement.toString()
Previous:From: Dave CramerDate: 2005-12-19 20:55:35
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group