Although we try to writeProgramControl the data inserted into the database, instead of using the database to judge whether the data is right or wrong, but sometimes for convenience, we still need the database's own fault tolerance capabilities to help us achieve our goal. Example:
Create the following data table
Create Table 'book' ('id' int (11) default null, 'num' int (11) unsigned default null) engine = InnoDB default charset = GBK insert into bookvalues (1, 0), (2, 0)
If you execute update book set num = 'abc', no error is reported because the strict mode is not enabled. So
Run set SQL _mode = "strict_trans_tables, no_auto_create_user, no_engine_substitution ",
Then execute update book set num = 'abc' and the database reports an error.
If you want to do this all, set the relevant parameters in the database configuration file my. ini
# Set the SQL mode to strict
SQL-mode = "strict_trans_tables, no_auto_create_user, no_engine_substitution"