Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: How to retrieve ENUM values by INDEX

From: Andrew Sayers <andrew-mysqlpp(at)pileofstuff.org>
Date: Wed Jul 18 2007 - 19:55:53 EDT


>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=lists@pantek.com
Received on Wed Jul 18 19:56:14 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:28:32 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library