Is there a way to grab the enum values from a mySQ...
# cfml-general
j
Is there a way to grab the enum values from a mySQL table via
cfdbinfo()
? I’m running it with
Columns
but not seeing it.
Yeah, but is there any way to extract the enum values that are stored in the table identity?
It’s ok, there’s a SQL way to do this… I was just curious if I was missing something
g
Sorry James I think I have just "clicked" with what you need. As far as I know - there isn't even a "nice" way to do it via direct SQL - let alone a CFML function. The mySql reference has this _*To determine all possible values for an ENUM column, use SHOW COLUMNS FROM tbl_name LIKE 'enum_col' and parse the ENUM definition in the Type column of the output.*_ Here's a link that Mr.Google found for me - but your mileage may vary! https://www.tutorialspoint.com/how-can-i-get-enum-possible-values-in-a-mysql-database-using-php Though it does look like you might just need to write your own function for it.
j
No worries, yeah, I’m going the route of
SHOW COLUMNS FROM $Table LIKE "$somefieldname"
@gavinbaumanis there was not a nice way LOL this how I got it
Copy code
someEnum = queryExecute("SHOW COLUMNS FROM `$someTable` LIKE :enumCol" ,{enumCol="$someColName"}, $options).Type;
👍 1