Subject: any better way?
From: "deco" <[EMAIL PROTECTED]>
 ===
I have a bunch of data stored on a file and organized in messages... I got a
message header and depending on the message type, i'll get a sequence of
values which can be double, float, long, int, char, etc...

Now i want to put this info in a mysql db, and i'm following this table
structure (the whole thing is a bit more complicated, but this simple
structure i think gives a nice picture of what i mean):
TABLE types (
    value_type_code    INT;
    value_type_description    TINYTEXT
);
TABLE reads (
    value_type_code    INT;
    read_value    TINYBLOB
);

So, the thing is 'read_value' can be anything from a double, float, int, etc
and so has a variable length. My solution was to have it like a TINYBLOB,
where i may loose some space from the header (1 byte per record) but it's
not very significative for me.
But from here i'll have to be able to somehow make typecasts so i can make
querys where i compare this blob values, and i don't quite know how to do
this!!

And i don't know if this is the best way to go, but i would surely be glad
to hear from you all... The only other ways i thought of was to have this
field like a double for all values, but it's not good. Other way was to have
a different table for each value type, but that wouldn't be nice as i wan't
to easily add new types as i go along!!

Thanks in advance,
    Ricardo Rocha



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to