Re: bit datatype and getObject()

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: bit datatype and getObject()
Дата
Msg-id alpine.BSO.2.00.1012221442490.19025@leary.csoft.net
обсуждение исходный текст
Ответ на Re: bit datatype and getObject()  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: bit datatype and getObject()  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-jdbc

On Wed, 22 Dec 2010, Kevin Grittner wrote:

> What would the Java String look like for SQL B'101' ?

"101"

> Would bool[] make any sense for an object type?

Conceivably.

> I'm not sure byte[] would be out of the question, but it would need
> zero padding on one side or the other, and you would lose the exact
> length.  :-(

boolean[] seems better to me than byte[].  One of the appeals of a
distinct/unique type like BitSet is that you can then implement
PreparedStatement.setObject and have it implement the reverse transform to
pass the data to the server with type safety that you wouldn't get using a
String.  At the moment we don't do anything intelligent with native array
types, but if we did we wouldn't know if boolean[] should turn into varbit
or bit(1)[].

> What do other drivers do?  Is there any guidance in the JDBC
> standard?

The standard says nothing useful.  Section 8.3.3 of this document implies
that as an application developer you should just pretend multi-bit strings
don't exist...

http://download.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html

Mysql's documentation shows it using byte[].

http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-type-conversions.html

Oracle doesn't look like it supports it.

I think IBM uses byte[], I'm not familiar with DB2 data types to
understand what's the equivalent of bytea and what's varbi, but they both
seem to be mapped to byte[].

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/rjvjdata.htm

Kris Jurka

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: bit datatype and getObject()
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: bit datatype and getObject()