经过一段时间试图杀死这个bug,我直接测试了SQL查询:
UPDATE noticias SET
data_destaque_ini='2013-12-03', data_destaque_fim='',
fotoDestaque_x=-3, fotoDestaque_y=-102,
fotoDestaque_escala=154, destacar=1
WHERE idNoticia=3
但fotoDestaque_escala保持与以前相同的值:127.嗯,这是一个“圆”数,对吗?因此,即使没有任何sql错误消息,我打开了结构,就是这样:列设置为tinyint(-127到127),并将其更改为SMALLINT解决了问题.
但是考虑到未来,我对MysqL的这种行为感到震惊:我为这个专栏传递了太大的价值,MysqL保存了可能的东西,削减了其余部分,并且没有说出任何关于 – 客户端仍处于黑暗状态!
那么,有没有办法以某种方式配置或检测溢出?如果没有,我正在考虑在我的库中进行PHP级别测试…
解决方法:
直接取自MysqL文档中的11.2.6 Out-of-Range and Overflow Handling:
When MysqL stores a value in a numeric column that is outside the permissible range of the column data type, the result depends on the sql mode in effect at the time:
因此,如果您想要一个错误,您需要将MysqL置于严格的sql模式.如何更改模式在5.1.7 Server SQL Modes中描述.