Re: Allow setObject(x,y,Types.BIT) if y is a Number &

Поиск
Список
Период
Сортировка
От Kim Ho
Тема Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Дата
Msg-id 1056752907.5081.29.camel@cpe000475c4cd62-cm013279901416.cpe.net.cable.rogers.com
обсуждение исходный текст
Ответ на Allow setObject(x,y,Types.BIT) if y is a Number & getObject() on bit columns  (Kim Ho <kho@redhat.com>)
Ответы Re: Allow setObject(x,y,Types.BIT) if y is a Number &  (Barry Lind <blind@xythos.com>)
Список pgsql-jdbc
On Wed, 2003-06-18 at 13:09, Kim Ho wrote:
> Problem:
>  - setObject(x,y,Types.BIT) throws an exception if y is a Number
>  - getObject() on a bit column will return null instead of True or False
> Boolean objects
>
Added Problem:
 - Doesn't set bit columns

> Fix:
>  - Added check in setObject() to check to that the Number has value==1.
> If so, set to True. False otherwise. This seems to be consistent with
> the rest of the code.
>  - Added BIT to JDBC datatype list
 - Using way to set values in both boolean/bit type columns

It works now.

The following program works now:

Statement stmt = con.createStatement();
stmt.execute("Create Table bit_tab (b bit)");

PreparedStatement pstmt = con.prepareStatement("insert into bit_tab
values (?)");
pstmt.setBoolean(1,true);
pstmt.execute();

Sorry bout the delay.

Cheers,

Kim


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kim Ho
Дата:
Сообщение: Re: BIT vs boolean
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Client_encoding