查询

userId 在数据库中为int类型

select * from userinfo where userId = 0

等于

select * from userinfo where userId = ''

容易出现bug

当id为int类型,根据id批量(逻辑)删除记录时。

update userinfo set isdel = 1 where userId in('')

这里尽管没有删除,但是空字符串会被当成0来执行。会把id为0的删除掉。

解决办法就是当id不存在时不执行此语句。 

相关文章:

  • 2021-06-15
  • 2021-03-31
  • 2021-06-30
  • 2021-08-29
  • 2021-06-30
  • 2021-09-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案