Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Enum MySQL datatype
Enum MySQL datatype [message #27] Thu, 11 May 2006 04:04 Go to previous message
johandewit is currently offline  johandewit
Messages: 25
Registered: May 2006
Location: Belgium
Junior Member
Hi,

There is support for this datatype, but looking at the examples, it isn't used anywere. Instead the enum type replaced by a dropdown list generated buy the function getLanguageArray();

i'm using the enum type in those cases where processing depends on the value.

Eg. An amployee database. People can have different states like
These states are assigned to some action type, like active or inactive. Depending on the action type, there will be a different processing of the record.

state action
working active
retired inactive
ill inactive
resigned inactive

Eg. Inactive people cannot get a pay raise while active do.

The states will be defined in <sybsystem>text/en/language_array.inc, while the different actions are defined in the database using the enum type.

My common sense tells me for both the state and action, one should use drop down list. The state optionlist is retreived from the text file using the getlanguageArray() function, while the action option list is retreived from the database using the getEnum() method.

Only problem I encountered is that when using the enum type, the validaeField() function always returned an error which makes the Insert/Update impossible.

Following diff solved thois problem, but I don't know if this is the desired enum type validation.
The index value as retreived from the dropdown is replaced with the value. No real validation is done, but since dropdown lists are used, I don't think this is really needed.

Is it a good thing if we encounter an enum type, the optionlist and dropdown input type should be used by default ? In the <specific>.table.class, we should not repeat this for every enum type. If the enum field is required (not NULL), and has a default value, this should be selected with the 'inser' mode. Otherwise the value from the database should be selected. Only if the enum field is optional, an empty line should be added to the optionlist.

Right know, I have always two empty lines in the 'new' screen. Even if I remove the empty line from the optionlist.

I'm willing to give it a try to implement the enum type behavour as described above if this is the desired behaviour.

Greetings

Johan










 
Read Message
Read Message
Read Message
Read Message
Next Topic: //DebugBreak();
Goto Forum:
  


Current Time: Thu Nov 28 04:50:07 EST 2024

Total time taken to generate the page: 0.01043 seconds