Subject RE: [ib-support] Datatypes
Author Richard Pendered
You could do one of the following
1) define a check constraint for the allowed values
2) define a domain like the above
3) have a lookup table and use a foreign key constraint.

-----Original Message-----
From: Gary Robson [mailto:gary.robson@...]
Sent: 24 January 2002 12:25
To: ib-support@yahoogroups.com
Subject: RE: [ib-support] Datatypes


Just to explain sets and enums

ENUMs in MySQL allow you to define a set of allowed values for the field

i.e. 'cat',dog',....
the field can only contain one of the values listed above, so far you
could use CONSTRAINTS (I think!). The twist is, when the table is
created
each of these values is given a numerical value as well, so 'cat'=1,
'dog'=2 etc
When you use the fields in querys and functions the value returned
depends on the context in which it is used, if you treat the field as a
number then that is what will be returned, if you treat it as a text
string then 'cat' or 'dog' etc will be returned. The same also applies
to INSERTs etc

SETs are very similar but evaluate the allowed value as 1,2,4,8,16,32,64
etc therefore allowing multiple values in a field. The information in
the tables ends up being very readable, but still allows me to treat the
fields as numeric (using a bitmask to remove a value from the field is a
lot easier than recreating the string without that value).



-----Original Message-----
From: Paul Reeves [mailto:paul@...]
Sent: 24 January 2002 11:54
To: ib-support@yahoogroups.com
Subject: Re: [ib-support] Datatypes

Gary Robson wrote:
>
> I have hit a problem with Firebirds datatypes, does
> Firebird have an equivalent
> of MySQLs SETs and ENUMs?
>

Possibly not. Maybe you could explain what these datatypes achieve -
that way
we could tell you how Firebird will accomplish the same result.

I don't know too much about MySQL, however it appears to be a long way
from
compliance with the ANSI standard (any of them) and some would argue
that it
is not a relational database server. None of that is really the point -
it
gets the job done for a lot of people and is often the right solution.
Unfortunately, it doesn't help migration.


Paul
--

Paul Reeves
http://www.ibphoenix.com
taking InterBase further



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/