Re: Why is bool == java.sql.Types.BIT ??

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Why is bool == java.sql.Types.BIT ??
Дата
Msg-id 4386277B.8070906@opencloud.com
обсуждение исходный текст
Ответ на Re: Why is bool == java.sql.Types.BIT ??  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-jdbc
Thomas Kellerer wrote:
> Oliver Jowett wrote on 24.11.2005 00:50:
>
>> Thomas Kellerer wrote:
>>
>>> The problem comes when supporting multiple DBMS. With MS SQL Server a
>>> bit column can only store 0/1 (which is not what the driver returns,
>>> as it uses a java.lang.Boolean) but PG only accepts the literals
>>> true/false. That's why I stumbled over this in the first place.
>>>
>>> So I'll have to check the native type rather then the JDBC type to be
>>> sure.
>>
>>
>>
>> Can't you use setBoolean()/getBoolean()? I think that's specified to
>> always work on a BIT column, whatever the real underlying type is.
>>
>
> Yes of course I can and actually I do when using PreparedStatements
> But when I'm generating SQL Scripts I need to use the correct literal
> for such a column.

Well, if you're going to bypass the abstractions that JDBC gives you to
deal with this sort of case, of course you will end up with
DBMS-specific code..

-O

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Can PostgreSQL do data type automated casting in
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Can PostgreSQL do data type automated casting in