Henning Sprang wrote:
> 
> Am 21 Dec 2001 15:57:13 +0100 schrieb Carsten H. Pedersen:
> >
> > > I would like to know if there is a possibility to get all allowed
> values
> > > of an enum field out of the database.
> > >
> > > I know there are methods to get the field type and those give me back
> > > something like "enum('value1', 'value2', 'value3')", and I can parse my
> > > possible values out of this with regexp's in the Programming language of
> > > my Choice, but I am interested to know if there isn't a more "beautiful"
> > > possibility where Mysql gives me back the result direct.
> >
> > SELECT DISTINCT enum_col FROM tablename WHERE enum_col<256;
> 
> thanks for the quick reply, but this is then dependent on the fact that
> there is already at least one entry for each possible value as defined
> in the enum array of the field type definition.
> What if, by some chance, all entries with one of the possible options
> are deleted and i still want to make it available for users when
> creating new entries to choose?

If you use perl/php/C etc. API, you may use 'desc your_table' then grep
enum_col line to parse the values.

> 
> It is more beautiful in the aspect that I described, but then less
> beautiful in another aspect...
> 
> any guesses without hooks? Or is it simply not possible the way I
> imagine?
> 
> BTW: why enum_col<256?
> 
> TIA,
> henning
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to