pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: j.random.programmer <javadesigner@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT
Date: Tue, 20 Dec 2005 07:03:40 +0000
Message-ID: <43A7ACCC.3020601@opencloud.com> (raw)
In-Reply-To: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com>
References: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com>

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



view thread (14+ messages)  latest in thread

Message-ID: <43A7ACCC.3020601@opencloud.com>
Permalink:  ../43A7ACCC.3020601@opencloud.com/
Also on:    postgresql.org/message-id/43A7ACCC.3020601@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, javadesigner@yahoo.com
  Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT
  In-Reply-To: <43A7ACCC.3020601@opencloud.com>
  References: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com> <43A7ACCC.3020601@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox