Subject | Re: datatype "enum"? |
---|---|
Author | GeorgLedermann |
Post date | 2005-11-09T11:20:46Z |
<m.tonies@u...> wrote:
Think about a field like "gender". It may have the values "male",
"female" or "unknown". For not storing chars in the database, some
kind of integer (0,1,2) should be used for storing. There is a
mapping: 0=unknown, 1=male, 2=female
But a statement like "SELECT gender FROM contact" should give string
results. In addition a statement like "UPDATE contact SET
gender='male') should be possible. But internally only integer should
be stored. The predefined and possible values should be part of the
schema.
Kind regards,
Georg
> "enum" actually isn't a datatype at all. It's more of a stringBut that is exactly what I mean.
> datatype with a set of possible values.
Think about a field like "gender". It may have the values "male",
"female" or "unknown". For not storing chars in the database, some
kind of integer (0,1,2) should be used for storing. There is a
mapping: 0=unknown, 1=male, 2=female
But a statement like "SELECT gender FROM contact" should give string
results. In addition a statement like "UPDATE contact SET
gender='male') should be possible. But internally only integer should
be stored. The predefined and possible values should be part of the
schema.
> Now, "enum" itself is badly implemented.Maybe. But in Firebird it can be implemented in a better way ;-)
Kind regards,
Georg