Re: [Mysql-cocoa-users] Bug with BigInt data types
Brought to you by:
sergecohen
|
From: Serge C. <ser...@us...> - 2003-08-21 02:17:13
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Lorenz;
Following your last mail, I just tried to understand what I was=20
missing... and I found it (meaning we might be halfway to solving the=20
problem)...
I've wrote a small program to check the size of the different integer=20
types on MacOSX :
#include <stdio.h>
int main(int argc, char **argv)
{
printf("short : %d, int : %d, long : %d, long* : %d, long long : %d,=20=
void* : %d\n",
sizeof(short),sizeof(int), sizeof(long), sizeof(long *),=20
sizeof(long long), sizeof(void*));
return 0;
}
if you compile it (gcc -o sizetst sizes.c), and run it (sizetst), you=20
get the memory size of these types:
short : 2, int : 4, long : 4, long* : 4, long long : 8, void* : 4
^^^^^^^^
And then I realised that long was indeed (as int) a 32 bit integer, to=20=
have a 64bit integer one need to use long long...
SO to correct the list I've sent in my last time, one should have=20
indeed:
* SMALLINT : 16 bits (short int in C).
* MEDIUMINT : 24 bits (inexistent in C).
* INT or INTEGER : 32 bits (int in C).
* BIGINT : 64 bits (long long in C) -- was long int in the previous=20
(wrong) list --.
So now that I've understand what the problem is, I still have to find a=20=
way to correct that... The problem being that I don't know any function=20=
in C which is able to parse an integer into a long long... (and I don't=20=
manage to find my Kernigam & Richie in my library...).
As soon as I find the solution, I'll post it here, and correct the=20
framework.
Serge.
PS: indeed I also have to thank you for the MySQL front-end you are=20
maintaining, it is very useful.
Le mercredi, 20 ao=FB 2003, =E0 22:18 Europe/Amsterdam, Lorenz Textor a=20=
=E9crit :
> Hi Serge,
>
> Thank you for your quick answer!
>
> I'm using an old version, but I have checked the current version and=20=
> it seems to use the same method to get the numeric values.
>
> The field is of type BigInt and not unsigned, and the value is showed=20=
> correctly in other tools. If I open the table in my app, it shows=20
> always 2147483647 for values greater than this. I've tested it also=20
> with your MySQL Display app to be sure that it it is not an error of=20=
> my app - with the same result.
>
> Please tell me if I should test it with the newest version of the=20
> framework too! It's not that important, so look at it only if you have=20=
> the time... I'll also look at it, but I don't understand enough of=20
> this things (can it be a problem of the method numberWithLong: ?).
>
> Thanks very much for your work on the framework, it's really great!
> Cheers,
> Lorenz
>
- ----------------------------------------------------
Serge Cohen
GPG Key ID: 9CBB58FB
- ----------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)
iD8DBQE/Q/z05EPeG5y7WPsRApFTAKCoydRlZ15rAI2S1hxL3qK1aCmlvwCggJas
QIf/mOa9xU17KgI4agoewHE=3D
=3DR9n2
-----END PGP SIGNATURE-----
|