Don't ask to ask, just ask | |
PerlMonks |
Re: Synchronizing constants/enums in database and codeby hardburn (Abbot) |
on Apr 11, 2004 at 13:35 UTC ( [id://344255]=note: print w/replies, xml ) | Need Help?? |
Enums are a hack for the fact that MySQL didn't have proper referential integrity until recently. In this case, the better answer is probably to put your column in a seperate table which is linked to with a foreign key. You can use a subselect (another thing MySQL only recently got) to get the data back out:
Yes, there is a performance hit. It's also a much cleaner implementation. Update: s/FOREGIN/FOREIGN/. Thanks to cLive ;-). ---- Note: All code is untested, unless otherwise stated
In Section
Meditations
|
|