6 messages in com.mysql.lists.plusplusRe: How to retrieve ENUM values by INDEX| From | Sent On | Attachments |
|---|---|---|
| Zeddy Chirombe | 18 Jul 2007 16:30 | |
| Warren Young | 18 Jul 2007 16:51 | |
| Andrew Sayers | 18 Jul 2007 16:55 | |
| Zeddy Chirombe | 19 Jul 2007 08:39 | |
| Warren Young | 20 Jul 2007 05:49 | |
| Zeddy Chirombe | 20 Jul 2007 14:35 |
| Subject: | Re: How to retrieve ENUM values by INDEX![]() |
|---|---|
| From: | Zeddy Chirombe (zedd...@gmail.com) |
| Date: | 07/19/2007 08:39:17 AM |
| List: | com.mysql.lists.plusplus |
I doubt there's a mysql++-specific solution for this (although others know far more than me), because mysql++ isn't given any information about the mappings between ENUM names and numbers.
Andrew, that is correct according to Warren, that mysql++ has not insight regarding the translations whatsoever. However, I was hoping that Warren, since he is the authority here, could liaise with MySQL fellows to expose this info, so from MySQL++ perspective, we could then choose to make a call like raw_enum(int), inplace for raw_data(int), or vice-vesa.
--Thanks for helping out, --Zeddy
On 7/18/07, Andrew Sayers <andr...@pileofstuff.org> wrote:
From http://dev.mysql.com/doc/refman/4.1/en/enum.html:
If you retrieve an ENUM value in a numeric context, the column value's index is returned. For example, you can retrieve numeric values from an ENUM column like this:
mysql> SELECT enum_col+0 FROM tbl_name;
So the easiest solution is to change your query to "SELECT StudentID, StudentClub+0 FROM students" (note: the trailing ";" isn't necessary either).
I doubt there's a mysql++-specific solution for this (although others know far more than me), because mysql++ isn't given any information about the mappings between ENUM names and numbers.
- Andrew
-- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=zedd...@gmail.com




