-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here it comes:
create table dec_test (a decimal(1,0)) type=myisam;
insert into dec_test values(5);
dec_test.MYD --> FD 85 00 00 00
create table dec_test_20_10 (a decimal(20,10)) type=myisam;
insert into dec_test_20_10 values(1234567899.1234567899)
dec_test_20_10.MYD -->
FD 81 0D FB 38 DB 07 5B CD 15 09
Well, the 20_10-test seems to be correct now, but why uses MySQL 4 Byte
in the first examle? May this depend on the block size?
Hagen
Sergei Golubchik wrote:
> Hi!
>
> On May 24, Hagen H?pfner wrote:
>
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>Dear List,
>>
>>I currently try to figure out, how decimal values are stored in MySQL. I
>>read about the changes in 5.0.3 but could not comprehend it under 5.0.4
>>beta. However,
>>
>>http://dev.mysql.com/doc/mysql/en/precision-math-decimal-changes.html
>>
>>mentioned, that 9 digits of a decimal value are stored in 4 byte. That
>>means, that Decimal(18,9) as well as Decimal(1,0) requires 8 Byte (4 for
>>the integer part and 4 for the fractional part).
>
>
> DECIMAL(1,0) requires only one byte.
>
>
>>A Decimal (20,10) should require one additional byte. So I created a
>>MyISAM Table, inserted a value and looked at the hexdump. But the
>>Decimal(20,10) value is also represented by 8 bytes.
>
>
> It should take 10 bytes.
> What was in your dump ?
>
> Regards,
> Sergei
>
- --
- ------------------------------------------------------------
Dr.-Ing. Hagen Höpfner | hoepfner@stripped | +49 7251 700 239
- ------------------------------------------------------------
http://www.i-u.de/schools/hopfner/index.html
International University in Germany
School of Information Technology
Campus 3 D-76646 Bruchsal
- ------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: GnuPT 2.6.0 by EQUIPMENTE.DE
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCk0y/ataeEpWdQtYRAv0DAJ4rckyKUzdHOmSzM14NpSK61Ua+lACePPiK
2K1JZSY2YxDxh/rEVn9RAYg=
=I1MK
-----END PGP SIGNATURE-----