473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

enum type, sort, restrict, use

After reading that enum column is very efficient, I'm determined to use
it where I can.
Does anyone have WebApp experiences, that make life easier.

I can see applications for US states, phone types, order types, etc.
but for example
in a contact manager business phone types may differ than personal
phone types
ie:
work
home
cell
247
pager
day
eve

I guess this column type is best used with a mutually exclusive,
defined, stable set of choices, and can be difficult to use otherwise.

Jan 11 '06 #1
2 1521
btw, is there anyway to select all the possible values of an enum, to
create a <select><option>.... list ?

Jan 12 '06 #2
"awebguynow" <i_****@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
After reading that enum column is very efficient, I'm determined to use
it where I can.
That's not a good reason to use a data structure. A scalar variable is more
"efficient" than an array, but would you use a scalar where you need an
array?
I guess this column type is best used with a mutually exclusive,
defined, stable set of choices, and can be difficult to use otherwise.
Correct. I would use enum only for fields where the list of values is by
definition immutable. The only one that comes to mind is defining an enum
of male/female for a non-nullable Gender column.

In most cases where I see people misusing enums, it would be better to have
an additional table containing the valid values, and where you would have
used an enum, instead use a foreign key. The reason is that in most cases
of misuse of enums, it's because the set of values are likely to change
during the lifetime of the application. It's very easy to change the values
by adding a row to a lookup table, but it's awkward and risky to adjust your
enum definition every time this happens.
is there anyway to select all the possible values of an enum, to
create a <select><option>.... list ?


If you use a lookup table instead of an enum, it's very easy to get the list
of valid values.

Regards,
Bill K.
Jan 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alexander Grigoriev | last post by:
Not quite new version of GCC that I have to use, craps with the following code: enum E; enum E { e }; That is, it doesn't accept forward declaration of enum. C++ standard text doesn't...
2
by: mrhicks | last post by:
Hello all, I have a question about enumerations. Within some requirements data passed back a certain bit field is defined by three bits then in another section the bit field is defined as 4...
5
by: Rouben Rostamian | last post by:
I searched the C99 standard and clc's FAQ but was unable to find an answer to the following issue. I hope that someone here can illuminate me. Suppose I have: enum myenum { enuma, enumb,...
18
by: Nebula | last post by:
Consider enum Side {Back,Front,Top,Bottom}; enum Side a; Now, why is a = 124; legal (well it really is an integer, but still, checking could be performed..) ? Wouldn't enums be more useful if...
4
by: O. Zimmermann | last post by:
Hi all, A variable with an enumerated type can be set with a value from any other generic "enum" type in the program, or with an integer value, without notice to the user, neither at compilation...
21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
15
by: apm | last post by:
Can an enum start empty and be added to on the fly?
7
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
3
by: Ralfeus | last post by:
Hi all Oftenly I need to use enums but standard C# enums provide little bit poor possibilities. For example I'd like to restrict variables to get only values specified in enums. Also sometimes I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.