MySQL Enum's always contain '' (empty string) in possibilities -


I'm trying to create a simple 'yes' / 'may' / 'not', in mysql I can not set NULL with PhpMyAdmin, and 'Maybe' as default value

I expect an error while executing something like "SET EnumCol = '', because '' ( An empty string) should not be a valid value. But the query is executed and the value is set to '' - this means that I am forced to double check for this unwanted and illegal value while reading from the database!

Is there a bug in MySQL or phpMyAdmin? Does anyone know a way to disable this behavior?

Thank you.

In the empty string ENUM there is an error indicator of invalid values ​​from Mysql: < / P>

If you enter an invalid value in an ENUM (which is, a string is not present in the list of allowed values), the empty string is inserted as special error value. This string can be separated with the "normal" empty string, that the string numeric value is 0. More information about this.

Behavior to disable it:

If strict SQL mode is enabled, then attempts to insert invalid ENUM value.

Enable hard mode to enable.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -