Home > Archive > PostgreSQL JDBC > December 2005 > Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2005-12-20, 3:24 am

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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com