
Member
|
I have a prefix to an int input. I wanted to isolate the number from the other inputs and so i am using not only the prefix but another enum field as well. All of that is fine.
Thinking about this process there are good and bad either way i code it so i wanted to ask to get some opinions of which way is better. By better i mean a better mix safe and less maintenance (code wise).
So here are my options:
1. I could make the field VARCHAR and include the NC- in the data field along with the int value. This would allow me to remove the enum field im using as a partner to qualify the VARCHAR field. Thiet ke website But it would also mean that i would have to explode the values every time i wanted to use the int value. Plus it would be less secure than a strictly int field.
2. I could leave the field as int and process the existance of the NC- prefix inside with my coding, either excluding it or including it. To the user it would all seem the same but inside i would need to create more code to manage the inclusion and exclusion for both visual as well as data integrity. However the int field would be a safer choice, but alittle more work to use it as i want.
3. I could leave it as int value and just have a seperate VARCHAR field instead of the enum switch, have it contain the NC-
Are we talking "which came first the chicken or the egg" as in it really does not matter which way. OR is there a preference that some of you with experience have said,
if i had to do it again i would have done it this way or that way.
I am thinking there may be some pitfalls that i am not seeing right now.
Thanks
thiết kế website
|