开发者

List MySQL enum in Java

开发者 https://www.devze.com 2022-12-22 14:53 出处:网络
Is there a way to get all possible values from a MySQL enum co开发者_JAVA百科lumn? The MySQL documentation says the MySQL enum type is returned as a Java String, so I basically would like a way to ge

Is there a way to get all possible values from a MySQL enum co开发者_JAVA百科lumn?

The MySQL documentation says the MySQL enum type is returned as a Java String, so I basically would like a way to get all possible strings I can pass when querying a table with such an enum.

I couldn't immediately find anything when I was looking through the metadata returned for such a column, but since enum isn't standard SQL, I'm not sure it's even possible... any suggestions?


SHOW COLUMNS FROM Table LIKE field returns something like: enum('value1','value2','value3','value4'). Parse out the enum values from the string with a regular expression ("/'(.*?)'/").

0

精彩评论

暂无评论...
验证码 换一张
取 消