Re: mailing.database.mysql-internals, mailing.database.mysql, mailing.database.mysql-java, comp.lang.java.programmer

From: Mark Matthews (mark_at_mysql.com)
Date: 02/21/04


Date: Sat, 21 Feb 2004 11:40:08 -0600
To: Albretch <lbrtchx@hotmail.com>

Albretch wrote:

> if you check the store requirements of column types in mysql,
>
> http://mysql.azc.uam.mx/doc/en/Storage_requirements.html
>
> You will see advertised that, for example, for storing a TINYINT they
> use a byte, but when you create a table using the different types of
> data:
>

[snip]
> You will for example see that for a tinyint 4 bytes are being used
> and that the column type in string format, does not return the
> 'unsigned' type specifier. Also, apparenly MySQL uses one byte less
> for 'unsigned' variables.
>
> Which is a little fishy to me. Both 'signed' and 'unsigned' variables
> should use the same storage they are just interpreted differently,
> since just one bit is used for the sign.

Albretch,

The column COLUMN_SIZE is not a storage length specifier, it specifies
precision (i.e. number of digits), according to the JDBC spec.

>
> MySQL returns the same DATA_TYPE in the form of an java.sql.Types int
> and TYPE_NAME as a String for 'signed' and 'unsigned' variables
>
> Trying to use the difference in the COLUMN_SIZE specifier does not
> work for example for 'BIGINT' and 'BIGINT UNSIGNED'.

This has been fixed in the source repository for the driver, so that
when you retrieve TYPE_NAME, it will end with 'unsigned' for the
unsigned types. Therefore it will show up in Connector/J 3.0.12 and
Connector/J 3.1.2. Thanks for pointing out the bug!

Regards,

        -Mark

-- 
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/