Working with the
SQL_MODE can be tricky, because it’s a command separated list involving long keywords. To be honest, I hate to rewrite the flags, trying to read an unreadable list, etc. Of course some string functions can help (Justin Swanhart suggests to use
REPLACE() to make comma-separated lists readable).
I made a small set of Stored Routines wich allow me to easily show
SQL_MODE, add a flag, drop a flag and check if a flag is set. These routines work with the
SQL_MODE; if you don’t like this, simply replace “@@global.” with “@@session.” in the