List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 24 2003 2:18am
Subject:Re: ENUM
View as plain text  
At 21:14 -0400 5/23/03, Urb LeJeune wrote:
>At 08:00 PM 5/23/03 -0500, Paul DuBois wrote:
>>At 19:34 -0400 5/23/03, Urb LeJeune wrote:
>>>         I'm trying to extract the enumeration from a field defined as
>>>
>>>Action enum('M', 'S', 'H', 'D' ) in a table named FieldInfo.
>>>
>>>         As I interpret the manual the command
>>>SELECT * FROM FieldInfo WHERE Action=0
>>>
>>>         I'm getting an empty set. Can anyone point me in the
>>>right direction?
>>
>>Sequential enumeration values are assigned values beginning with 1.
>>0 represents '', which is used for illegal values.  If all
>>values in the column are one of the four values you show, an
>>empty set would be the expected result.
>>
>>What are you trying to accomplish?
>
>Hi Paul and thanks for the reply.]
>
>         I'm writing a program that will generate a form based upon a supplied
>database and table. I want to convert the enumeration into a drop menu or
>radio buttons. I detect the field is an ENUM using mysql_field_flags(). What
>I want to do next if determine the "M', 'S', 'H', 'D' enumeration.

Do you mean you want to determine the relationship between the string
enumeration values and their numeric equivalents?

Why not just make the list element values and labels both the same, i.e.,
the string values?

Otherwise, you need to get the column definition (e.g., with SHOW
COLUMNS), yank out the list of values, and iterate through them to
determine their numeric values.  What language are you using?  C?
PHP?


>
>         Thanks for your help.
>
>Urb


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
ENUMUrb LeJeune24 May
  • Re: ENUMMartin Gainty24 May
  • Re: ENUMPaul DuBois24 May
    • Re: ENUMUrb LeJeune24 May
      • Re: ENUMPaul DuBois24 May
        • Re: ENUMUrb LeJeune24 May
          • Re: ENUMYerra Venkata Srinivasa Rao24 May
          • Re: ENUMPaul DuBois24 May