> In fact there's a whole lot of reasonable encodings.
> It can be a character data type with an encoding of Y/N (or J/N in German
shops, O/N in French shops, 0/1 in C-influenced shops, etc.)
> For numbers, some encode it as 0/1, others as 0/-1.
> Not all encodings are reasonable, but all are in use :-)

These are application-specific encodings, and I dare say they're all
"unreasonable". The JDBC specification says:

If the designated column has a datatype of CHAR or VARCHAR and contains a
"0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and
contains a 0, a value of false is returned. If the designated column has a
datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT,
TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is
returned.


Taken from
http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getBoolean(int)

Also, the SQL standard mentions bit values of 0 and 1:

              Note: BOOLEAN is the predefined enumeration type STANDARD.BOOLEAN
              with values (FALSE, TRUE). The equivalences

                  BOOLEAN'POS(FALSE)  0
                  BOOLEAN'POS(TRUE)  1

              define the correspondence between the bit values of 0 and 1
              and the Boolean values of false and true, respectively.

Taken from http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
(I didn't find any such reference in a later version of the standard,
in a quick document scan).

Chosing any other encoding for boolean values in a Java / SQL
application will probably just cause headaches without adding value.
If your legacy database does have such encodings, you can still use
jOOQ's converter feature

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to