Bug #65714 Method to get ENUM definitions from C API without direct table reference
Submitted: 22 Jun 2012 15:49 Modified: 23 Jun 2012 16:55
Reporter: Wolf Ihlenfeldt Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: C API (client library) Severity:S4 (Feature request)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: enum and set definition retrieval

[22 Jun 2012 15:49] Wolf Ihlenfeldt
The only way to get the enum or set definitions (needed for example to be able to re-map the string values of enum database table columns returned via the C API back to integer values) seems to require executing 'show columns' commands for the source tables. There appears to be no method to get this information, for example, from prepared statement metadata. 

In order to run 'show columns' statements, you need to identify the source table of the result column. That can be arbitrarily complex if your application processes user-generated SQL statements, essentially requiring a full SQL parser.

How to repeat:

Suggested fix:
It would be helpful if

a) 'show columns' accepted, as alternative to a table name, a 'select' statement and identified the column attributes of the result

b) there would be a C API function call to get enum/set definitions from a MYSQL_FIELD*
[23 Jun 2012 16:55] Valeriy Kravchuk
Thank you for the feature request.