开发者

How does MySQL handle storing ENUM value that doesn't exist?

For example suppose my ENUM is "a", "b", "c" and I try to store "d" how is MySQL supposed to behave? Also from a design perspective is there a correct way of ha开发者_C百科ndling this case? (your program receives "d" fo the above enum)


If you are using strict mode then an error will occur otherwise it will store an empty string with a value of zero.

The correct way to handle this case would be to ensure invalid values never get inserted or use another data type.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜