Is there any way to promote all mysql warnings to fatal errors? I'd like to avoid any data truncation (including fractional parts).
解决方案
In some modes, MySQL raises warnings instead of the errors that are required by the SQL Standard.
You certainly want to raise an error when significant data is removed, but you probably don't want an error raised when a COUNT(colname) expression finds some rows with nulls in the column and ignores them for counting purposes (a Standard warning).
As MySQL becomes more conformant to the Standard, warnings that do not have data integrity implications may be added.
If using MySQL in a mode that more closely follows the SQL Standard is not enough, you could catch the unacceptable warnings in your application code and add appropriate compensating actions.