Thread: bigint in mysql
View Single Post
  #2  
Old June 28th 03, 06:17 PM
Robert Geake
external usenet poster
 
Posts: n/a
Default bigint in mysql

Hi Allan

I do loads of MySQL at work. I i am ever unsure about a column
definition or data type i go for varchar(n) where n=how many chars
you want to a max of 255.

A simpler way to resolve the problem would be to add columns for
skyVersion, bla,bla,bla then split the objectID up before it goes into
the table.

Far less aggro


--
________________________
http://robert.thegeakes.co.uk/
51:21N 00:23E


"Allan Adler" wrote in message
...

The object ID of an celestial object in the Sloan Digital Sky Survey is
described as a 64 bit integer. If I want to make my own mysql database
for a few items I've downloaded (just for my own education), I can

preumably
declare the column for that object ID a bigint. This object ID actually
encodes 6 other items, called skyVersion, field, run, rerun, camcol, obj,
which can be extracted from the object ID by partitioning the 64 bit

binary
representation of the object ID.

The documentation for mysql leaves me a little puzzled as to how to
declare the object ID. I'm not even sure whether it really supports 64
bit unsigned integers or only 63 bits. There are some comments about
giving wrong answers at the most significant bits. It also says something
about declaring the bigint as a string and mysql being smart enough to
automatically convert it to an integer. It also says something about
arithmetic with these bigints being treated using doubles, i.e. floating
point, which it is the purpose of the string version to avoid.

Question 1: How do I declare the object ID (e.g. calling it objID) as a 64
bit integer in mysql?

Question 2: How should I extract the various items skyVersion, field, run,
rerun, camcol, obj from objID? I could do it, for example, by first

dividing
objID by 2^16 to get obj as a remainder, dividing the quotient by

something
else to get the next field as the remainder, dividing the new quotient
and so on. Would that get me involved in the floating point stuff that
one is trying to avoid? In any case, is there a mysql command that will
simply partition a 64 bit binary int into specified pieces?

Ignorantly,
Allan Adler



************************************************** **************************
*

*
* Disclaimer: I am a guest and *not* a member of the MIT Artificial

*
* Intelligence Lab. My actions and comments do not reflect

*
* in any way on MIT. Moreover, I am nowhere near the Boston

*
* metropolitan area.

*
*

*

************************************************** **************************